Skip to content

Instantly share code, notes, and snippets.

@taka-wang
Created September 25, 2020 08:23
Show Gist options
  • Save taka-wang/4d0c98d7826a9cd0fdf5dc813afa0075 to your computer and use it in GitHub Desktop.
Save taka-wang/4d0c98d7826a9cd0fdf5dc813afa0075 to your computer and use it in GitHub Desktop.
test
<div id='product-component-1601022034033'></div>
<script type="text/javascript">
/*<![CDATA[*/
(function () {
var scriptURL = 'https://sdks.shopifycdn.com/buy-button/latest/buy-button-storefront.min.js';
if (window.ShopifyBuy) {
if (window.ShopifyBuy.UI) {
ShopifyBuyInit();
} else {
loadScript();
}
} else {
loadScript();
}
function loadScript() {
var script = document.createElement('script');
script.async = true;
script.src = scriptURL;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script);
script.onload = ShopifyBuyInit;
}
function ShopifyBuyInit() {
var client = ShopifyBuy.buildClient({
domain: 'nilvana-ai.myshopify.com',
storefrontAccessToken: 'b70b38363a889f653a123bf5bd465fec',
});
ShopifyBuy.UI.onReady(client).then(function (ui) {
ui.createComponent('product', {
id: '5653700903076',
node: document.getElementById('product-component-1601022034033'),
moneyFormat: '%24%7B%7Bamount%7D%7D',
options: {
"product": {
"styles": {
"product": {
"@media (min-width: 601px)": {
"max-width": "calc(25% - 20px)",
"margin-left": "20px",
"margin-bottom": "50px"
}
},
"button": {
":hover": {
"background-color": "#2d9cc1"
},
"background-color": "#32add6",
":focus": {
"background-color": "#2d9cc1"
},
"padding-left": "26px",
"padding-right": "26px"
}
},
"buttonDestination": "modal",
"contents": {
"img": false,
"title": false,
"price": false,
"options": false
},
"text": {
"button": "Buy Now!"
}
},
"productSet": {
"styles": {
"products": {
"@media (min-width: 601px)": {
"margin-left": "-20px"
}
}
}
},
"modalProduct": {
"contents": {
"img": false,
"imgWithCarousel": true,
"button": false,
"buttonWithQuantity": true
},
"styles": {
"product": {
"@media (min-width: 601px)": {
"max-width": "100%",
"margin-left": "0px",
"margin-bottom": "0px"
}
},
"button": {
":hover": {
"background-color": "#2d9cc1"
},
"background-color": "#32add6",
":focus": {
"background-color": "#2d9cc1"
},
"padding-left": "26px",
"padding-right": "26px"
}
},
"text": {
"button": "Add to cart"
}
},
"cart": {
"styles": {
"button": {
":hover": {
"background-color": "#2d9cc1"
},
"background-color": "#32add6",
":focus": {
"background-color": "#2d9cc1"
}
}
},
"text": {
"total": "Subtotal",
"button": "Checkout"
}
},
"toggle": {
"styles": {
"toggle": {
"background-color": "#32add6",
":hover": {
"background-color": "#2d9cc1"
},
":focus": {
"background-color": "#2d9cc1"
}
}
}
}
},
});
});
}
})();
/*]]>*/
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment