Skip to content

Instantly share code, notes, and snippets.

add_filter( 'bigcommerce/channels/enable-multi-channel', '__return_true' );
if (function_exists('geoip_detect2_get_info_from_current_ip')) {
$userInfo = geoip_detect2_get_info_from_current_ip();
do_action( 'php_console_log', $userInfo->country->isoCode );
if ($userInfo->country->isoCode == 'ES') {
add_filter( 'bigcommerce/channel/current', function( $channel ) {
// logic to set the channel
return get_term( 33, \BigCommerce\Taxonomies\Channel\Channel::NAME );
}, 10, 1 );
// all variable defines here
var pageLoading = 1;
var cartId = '';
var taxProductId = 118;
//var canadaState = '';
var paymentStep = 1;
localStorage.removeItem("taxProduct");
localStorage.removeItem('taxProductId');
@gje4
gje4 / Twilio SMS
Created September 29, 2020 14:21
"use strict";
const request = require("request-promise");
const stripe = require("stripe")(process.env.STRIPE_SECRET);
const BigCommerce = require("node-bigcommerce");
const bigCommerce = new BigCommerce({
logLevel: "info",
clientId: process.env.BC_CLIENT,
accessToken: process.env.BC_TOKEN,
storeHash: process.env.STORE_HASH,
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script>
var obs = new MutationObserver(function(mutations, observer) {
$.each(mutations, function(i, mutation) {
var addedNodes = $(mutation.addedNodes);
var selector = "form, .checkout-step-info";
var filteredEls = addedNodes.find(selector).addBack(selector);
filteredEls.each(function() {
//ADD EXTRA FIELD to SHIPPING OPTIONS
'use strict'
const request = require('request-promise')
async function checkoutBC(cartData) {
// https://api.bigcommerce.com/stores/{{store_hash}}/v3/carts/{{cart_id}}/redirect_urls
const options = {
method: 'POST',
uri: `https://api.bigcommerce.com/stores/q5fk0ac2gk/v3/carts/${cartData.data.id}/redirect_urls`,
headers: {
accept: 'application/json',
class LocalStorageFactory {
constructor() {
if (typeof localStorage === 'undefined' || localStorage === null) {
const { LocalStorage } = require('node-localstorage')
this.localStorage = new LocalStorage('./localStorage')
} else {
this.localStorage = window.localStorage
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
//Add calander
<script src="https://unpkg.com/js-datepicker"></script>
//Add Calander script you want to use
<script>
//observe timmer to ensure element is present to add calander on after
var obs = new MutationObserver(function(mutations, observer) {
$.each(mutations, function(i, mutation) {
var addedNodes = $(mutation.addedNodes);
import React from "react"
import Layout from "../components/layout"
import ReactDOM from "react-dom"
import Embedcheckout from "../components/embedcheckout"
export default () => {
function testing(){if(typeof window !== 'undefined'){
console.log('windowstaturl',window.history.state.checkoutData.data.embedded_checkout_url)
return window.history.state.checkoutData.data.embedded_checkout_url
'use strict'
const request = require('request-promise')
async function checkoutBC(cartData) {
// https://api.bigcommerce.com/stores/{{store_hash}}/v3/carts/{{cart_id}}/redirect_urls
const options = {
method: 'POST',
uri: `https://api.bigcommerce.com/stores/q5fk0ac2gk/v3/carts/${cartData.data.id}/redirect_urls`,
headers: {
accept: 'application/json',
'use strict'
const request = require('request-promise')
async function checkoutBC(cartData) {
// https://api.bigcommerce.com/stores/{{store_hash}}/v3/carts/{{cart_id}}/redirect_urls
const options = {
method: 'POST',
uri: `https://api.bigcommerce.com/stores/q5fk0ac2gk/v3/carts/${cartData.data.id}/redirect_urls`,
headers: {
accept: 'application/json',