Buy Now Button Wordpress Widget Displaying Twice

SoBeautyStuff
Tourist
4 0 2

Hi all,

I have used the Buy Botton Sales Channel to create both product and collection buy now codes, and when i paste the code EXACTLY as it is generated via Shopify, everything is duplicated in Wordpress. I have tried deleting all the code and pasting again, removing the widget all together and creating a new one, I have checked (and double checked) that the code is only pasted once. I just can't figure out what's going wrong.

 

Where I am generating the code:

Screen Shot 2021-02-28 at 7.24.48 PM.png

 Where I am pasting in my Wordpress sidebar widget:

Screen Shot 2021-02-28 at 7.25.18 PM.png

 

Link to one of my blog posts where i've generated a code for my collection (it's at the bottom of the side bar on the right): https://www.sobeautystuffblog.com/liner-waterproof-smudge-proof/ 

 

Code generated:

<div id='collection-component-1614539945961'></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: 'sobeautystuff.myshopify.com',
storefrontAccessToken: 'f1d0d0ef2f8779fcfb4f9af8ecc9e390',
});
ShopifyBuy.UI.onReady(client).then(function (ui) {
ui.createComponent('collection', {
id: '76603883583',
node: document.getElementById('collection-component-1614539945961'),
moneyFormat: '%C2%A3%7B%7Bamount%7D%7D',
options: {
"product": {
"styles": {
"product": {
"@media (min-width: 601px)": {
"max-width": "calc(25% - 20px)",
"margin-left": "20px",
"margin-bottom": "50px",
"width": "calc(25% - 20px)"
},
"img": {
"height": "calc(100% - 15px)",
"position": "absolute",
"left": "0",
"right": "0",
"top": "0"
},
"imgWrapper": {
"padding-top": "calc(75% + 15px)",
"position": "relative",
"height": "0"
}
},
"title": {
"font-size": "17px"
},
"button": {
":hover": {
"background-color": "#778a68"
},
"background-color": "#849974",
":focus": {
"background-color": "#778a68"
},
"border-radius": "27px",
"padding-left": "19px",
"padding-right": "19px"
}
},
"text": {
"button": "Add to cart"
}
},
"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": "#778a68"
},
"background-color": "#849974",
":focus": {
"background-color": "#778a68"
},
"border-radius": "27px",
"padding-left": "19px",
"padding-right": "19px"
},
"title": {
"font-family": "Helvetica Neue, sans-serif",
"font-weight": "bold",
"font-size": "26px",
"color": "#4c4c4c"
}
},
"text": {
"button": "Add to cart"
}
},
"option": {},
"cart": {
"styles": {
"button": {
":hover": {
"background-color": "#778a68"
},
"background-color": "#849974",
":focus": {
"background-color": "#778a68"
},
"border-radius": "27px"
}
},
"text": {
"total": "Subtotal",
"button": "Checkout"
}
},
"toggle": {
"styles": {
"toggle": {
"background-color": "#849974",
":hover": {
"background-color": "#778a68"
},
":focus": {
"background-color": "#778a68"
}
}
}
}
},
});
});
}
})();
/*]]>*/
</script>

 

 

 

Any ideas on how to resolve this? It's not the end of the world, but just looks a bit rubbish!

 

Thank you,

 

Sarah

0 Likes