Adding add a span to a buy button script.

Highlighted
New Member
1 0 0

I created a custom field in my homepage (www.contactsportssoap.com) which has three shopify buy buttons internal to the site. I am trying to add the stamped.io <span>  so that at the bottom of the script under the add to cart it shows how many reviews the product has received. Is this possible? I have included the buy button coding as well as the span I am trying to integrate. TIA

 

<center>
<div id="product-component-1580842682697"></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: 'contact-sports-soap.myshopify.com',
storefrontAccessToken: '47f0a1a66156be377b45db0bc40f3dbe',
});
ShopifyBuy.UI.onReady(client).then(function (ui) {
ui.createComponent('product', {
id: '4368020930612',
node: document.getElementById('product-component-1580842682697'),
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": {
"font-size": "18px",
"padding-top": "17px",
"padding-bottom": "17px",
"color": "#000000",
":hover": {
"color": "#000000",
"background-color": "#e69500"
},
"background-color": "#ffa500",
":focus": {
"background-color": "#e69500"
},
"border-radius": "40px"
},
"quantityInput": {
"font-size": "18px",
"padding-top": "17px",
"padding-bottom": "17px"
}
},
"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": {
"font-size": "18px",
"padding-top": "17px",
"padding-bottom": "17px",
"color": "#000000",
":hover": {
"color": "#000000",
"background-color": "#e69500"
},
"background-color": "#ffa500",
":focus": {
"background-color": "#e69500"
},
"border-radius": "40px"
},
"quantityInput": {
"font-size": "18px",
"padding-top": "17px",
"padding-bottom": "17px"
}
},
"text": {
"button": "Add to cart"
}
},
"cart": {
"styles": {
"button": {
"font-size": "18px",
"padding-top": "17px",
"padding-bottom": "17px",
"color": "#000000",
":hover": {
"color": "#000000",
"background-color": "#e69500"
},
"background-color": "#ffa500",
":focus": {
"background-color": "#e69500"
},
"border-radius": "40px"
}
},
"text": {
"total": "Subtotal",
"button": "Checkout"
}
},
"toggle": {
"styles": {
"toggle": {
"background-color": "#ffa500",
":hover": {
"background-color": "#e69500"
},
":focus": {
"background-color": "#e69500"
}
},
"count": {
"font-size": "18px",
"color": "#000000",
":hover": {
"color": "#000000"
}
},
"iconPath": {
"fill": "#000000"
}
}
}
},
});
});
}
})();
/*]]>*/
</script>
</center>

 

<span class="stamped-product-reviews-badge stamped-main-badge" data-id="{{ product.id }}" style="display: inline-block;">{{ product.metafields.stamped.badge }}</span>

0 Likes