Adding Google Merchant Top Quality Store Badge JS script to our Product Page

This topic has 4 replies, 2 voices, and was last updated 4 months, 2 weeks ago ago by Luca Rossi

  • Avatar: bnourse
    bnourse
    Participant
    August 2, 2024 at 22:28

    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 -->
    3 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    August 5, 2024 at 05:37

    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

    Avatar: bnourse
    bnourse
    Participant
    August 8, 2024 at 00:05

    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

    Avatar: Justin
    Luca Rossi
    Support staff
    August 8, 2024 at 04:41

    Hi @bnourse,

    You’re most welcome.

    If you need anything else feel free to let us know.

    Best Regards,
    The 8Theme Team

  • Viewing 4 results - 1 through 4 (of 4 total)

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

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.