Hello Giri,
Thank you for the help!
I just need a different HTML component for each product page on the dataset. I use the shopify buy button and dropship. Because I dropship, I cannot just export my items to the wix site and use their eccommerce shop even though I want to. And, I hate shopify’s customization so I can’t just use their service. So, I have to use HTML buy buttons from Shopify on my Wix website.
Each HTML component is a different buy button, which is why I need to add HTML to the dataset so that on the dynamic page the buy button changes with each product. I am trying to explain it, but it is a bit complicated.
This is one of my buy buttons:
/*<![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: 'peace-wolf.myshopify.com',
apiKey: '4778eed9ca9ff3bfe8c46191cb44f349',
appId: '6',
});
ShopifyBuy.UI.onReady(client).then(function (ui) {
ui.createComponent('product', {
id: [10252657417],
node: document.getElementById('product-component-1514498910109'),
moneyFormat: '${{amount}}',
options: {"product":{"variantId":"all","width":"240px","contents":{"img":false,"imgWithCarousel":false,"title":false,"variantTitle":false,"price":false,"description":false,"buttonWithQuantity":false,"quantity":false},"styles":{"product":{"@media (min-width: 601px)":{"max-width":"calc(25% - 20px)","margin-left":"20px","margin-bottom":"50px"}},"button":{"background-color":"#486c74","font-family":"Playfair Display, serif","font-size":"17px","padding-top":"16.5px","padding-bottom":"16.5px","padding-left":"50px","padding-right":"50px",":hover":{"background-color":"#416168"},"border-radius":"100px",":focus":{"background-color":"#416168"},"font-weight":"bold"},"variantTitle":{"font-family":"Playfair Display, serif","font-weight":"normal"},"title":{"font-family":"Playfair Display, serif"},"description":{"font-family":"Playfair Display, serif","font-weight":"normal"},"price":{"font-family":"Playfair Display, serif","font-weight":"normal"},"quantityInput":{"font-size":"17px","padding-top":"16.5px","padding-bottom":"16.5px"},"compareAt":{"font-family":"Playfair Display, serif","font-weight":"normal"}},"googleFonts":["Playfair Display","Playfair Display","Playfair Display","Playfair Display","Playfair Display","Playfair Display"]},"cart":{"contents":{"button":true},"styles":{"button":{"background-color":"#486c74","font-family":"Playfair Display, serif","font-size":"17px","padding-top":"16.5px","padding-bottom":"16.5px",":hover":{"background-color":"#416168"},"border-radius":"100px",":focus":{"background-color":"#416168"},"font-weight":"bold"},"footer":{"background-color":"#ffffff"}},"googleFonts":["Playfair Display"]},"modalProduct":{"contents":{"img":false,"imgWithCarousel":true,"variantTitle":false,"buttonWithQuantity":true,"button":false,"quantity":false},"styles":{"product":{"@media (min-width: 601px)":{"max-width":"100%","margin-left":"0px","margin-bottom":"0px"}},"button":{"background-color":"#486c74","font-family":"Playfair Display, serif","font-size":"17px","padding-top":"16.5px","padding-bottom":"16.5px","padding-left":"50px","padding-right":"50px",":hover":{"background-color":"#416168"},"border-radius":"100px",":focus":{"background-color":"#416168"},"font-weight":"bold"},"variantTitle":{"font-family":"Playfair Display, serif","font-weight":"normal"},"title":{"font-family":"Playfair Display, serif"},"description":{"font-family":"Playfair Display, serif","font-weight":"normal"},"price":{"font-family":"Playfair Display, serif","font-weight":"normal"},"quantityInput":{"font-size":"17px","padding-top":"16.5px","padding-bottom":"16.5px"},"compareAt":{"font-family":"Playfair Display, serif","font-weight":"normal"}},"googleFonts":["Playfair Display","Playfair Display","Playfair Display","Playfair Display","Playfair Display","Playfair Display"]},"toggle":{"styles":{"toggle":{"font-family":"Playfair Display, serif","background-color":"#486c74",":hover":{"background-color":"#416168"},":focus":{"background-color":"#416168"},"font-weight":"bold"},"count":{"font-size":"17px"}},"googleFonts":["Playfair Display"]},"option":{"styles":{"label":{"font-family":"Playfair Display, serif"},"select":{"font-family":"Playfair Display, serif"}},"googleFonts":["Playfair Display","Playfair Display"]},"productSet":{"styles":{"products":{"@media (min-width: 601px)":{"margin-left":"-20px"}}}}},
});
});
}
})();
/*]]>*/
</script>
You can see that if I make a dataset with a dynamic page and I use it for product pages, I have to have a different buy button on each page as well. But, I cannot find a way to add html to the dataset. This would be a lot easier if I were able to connect a rich text element from the dataset to the HTML iframe component.
Is there any way to get around this without code? I have been researching for about a couple of hours but unfortunately I don’t understand. I was even looking at Shopify’s buy button API to see if that made it easier but its for advanced coding.
Thank you immensely!
Sincerely, Coral