This topic has 4 replies, 2 voices, and was last updated 3 months, 2 weeks ago ago by Luca Rossi
Hello,
We are interested in adding this code script into the <head> section of our single product pages. It implements the Google Merchant Top Quality Store Badge. (see https://support.google.com/merchants/answer/14428754 )
Can you suggest the best way to go about this??
Thanks for your help,
Ben
<!-- BEGIN MerchantWidget Code -->
<script id='merchantWidgetScript'
src="https://www.gstatic.com/shopping/merchant/merchantwidget.js"
defer>
</script>
<script type="text/javascript">
merchantWidgetScript.addEventListener('load', function () {
merchantwidget.start({
position: 'RIGHT_BOTTOM'
});
});
</script>
<!-- END MerchantWidget Code -->
Dear Ben,
We hope this message finds you well. We would like to provide you with a code snippet that you can add to your snippet plugin. Please find the code below:
add_action('wp_head', 'n2t_wp_head');
function n2t_wp_head(){
if(is_product()){
?>
<!-- BEGIN MerchantWidget Code -->
<script id='merchantWidgetScript' src="https://www.gstatic.com/shopping/merchant/merchantwidget.js" defer></script>
<script type="text/javascript">
merchantWidgetScript.addEventListener('load', function () {
merchantwidget.start({
position: 'RIGHT_BOTTOM'
});
});
</script>
<!-- END MerchantWidget Code -->
<?php
}
}
We trust this code will be beneficial for your needs. Should you have any questions or require further assistance, please do not hesitate to contact us.
Best Regards,
The 8Theme Team
Luca,
Thanks for your prompt support with this. We’re still working through a hosting/firewall issue to enable, but this was a big help in moving things along.
Regards,
Ben
Hi @bnourse,
You’re most welcome.
If you need anything else feel free to let us know.
Best Regards,
The 8Theme Team
The issue related to '‘Adding Google Merchant Top Quality Store Badge JS script to our Product Page’' has been successfully resolved, and the topic is now closed for further responses