Hi, i’ve used the buy button to create a buy button on my custom web site. When i insert the code on my site i see a button on the right side of my page (i think it is the default scenario), but i want to add a button on my navigation menu and not see the default button on the right side of my pages.
<script type="text/javascript">
(function() {
var scriptURL = 'https://sdks.shopifycdn.com/buy-button/latest/buy-button-storefront.min.js';
if (window.ShopifyBuy && window.ShopifyBuy.UI) {
ShopifyBuyInit();
} else {
var script = document.createElement('script');
script.async = true;
script.src = scriptURL;
(document.head || document.body).appendChild(script);
script.onload = ShopifyBuyInit;
}
function ShopifyBuyInit() {
var client = ShopifyBuy.buildClient({
domain: 'mystore.myshopify.com',
storefrontAccessToken: 'my_token', // sostituisci con il token Buy Button
});
ShopifyBuy.UI.onReady(client).then(function(ui) {
ui.createComponent('product', {
id: "my_id",
node: document.getElementById('my-product-container'), // dove creare il Buy Button
options: {
product: {
buttonDestination: 'modal',
contents: {
img: false,
buttonWithQuantity: true, // solo questo pulsante
button: false, // rimuove duplicato
title: false,
price: false
}
},
cart: {
iframe: false,
sticky: false,
startOpen: false,
popup: true
},
toggle: {
iframe: false,
contents: {
icon: false,
count: false
}
},
toggles: [{
node: document.getElementById('my-cart-toggle-container')
}]
}
});
});
}
})();
</script>