Installing Rich Snippets on Adobe Commerce 2

      Installing Rich Snippets on Adobe Commerce 2


        Article Summary

        Products


        Reviews
        Supported plans

        Starter, Pro, Premium, Enterprise

        eCommerce Platform

        Adobe Commerce (Magento)

        To learn more about Rich Snippets and how they are automatically added to your store, please click here.

        Please note:
        Before you manually install any code, note that Yotpo now allows implementing Rich Snippets without any manual markup. We have a built in solution based on JSON/LD, to automatically add Rating Rich Snippets to your product pages. Learn more

        Automatic Rich Snippets (JSON-LD injection)

        Installing the Yotpo Plugin v. 2.4 and up will automatically inject the Rich Snippets code to your shop.

        You can view your Rich Snippets mark-up with Google's Testing Tool and see a separate Product tab that only contains Yotpo's Automatic Mark-up:However, if you don't see valid markup in the Structured Data Testing Tool or if you believe that Rich Snippets are not appearing in the Search Engine Organic Result Pages (SERPs), please contact Yotpo support

        Please note:
        If you are using an older version of Yotpo, please update the version via the Adobe Commerce 2 admin

        Manual markup (microdata)

        Enabling Rich Snippets

        Please note:
        Aggregate rating values won't start to appear until about 24 hours after you've activated Rich Snippets in Yotpo and implemented the code.

        To enable Rich Snippets (manual markup), do the following:

        1. In your Yotpo Reviews main menu, go to Meta & Google > Google Rich Snippets.
        2. Turn on the toggle to activate Google Rich Snippets.

        Retrieving aggregate scores

        Please note:
        Yotpo recommends a basic knowledge of HTML and microdata formatting as implementing Rich Snippets requires editing template files.

        To retrieve the total reviews and average score per product, place the following code according to your existing markup

        If you're using the Yotpo Reviews extension 4.0.0 and above:

        <!-- Yotpo's Rich Snippets START -->
        <?php 
            $rs_helper = $this->helper('Yotpo\Reviews\Helper\RichSnippets');
            $array = $rs_helper->getRichSnippet($this);
        ?>
        
        <?php if (isset($array["reviews_count"]) && $array["reviews_count"] != 0 ): ?>
         <div style="display:none" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
          <span itemprop="ratingValue"><?php echo $array["average_score"]; ?></span> 
          <span itemprop="reviewCount"><?php echo $array["reviews_count"]; ?></span>
         </div>
        <?php endif; ?>
        <!-- Yotpo's Rich Snippets END -->

        If you're using a previous version of the Yotpo extension:

        <!-- Yotpo's Rich Snippets START -->
        <?php 
            $rs_helper = $this->helper('Yotpo\Yotpo\Helper\RichSnippets');
            $array = $rs_helper->getRichSnippet($this);
        ?>
        
        <?php if (isset($array["reviews_count"]) && $array["reviews_count"] != 0 ): ?>
         <div style="display:none" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
          <span itemprop="ratingValue"><?php echo $array["average_score"]; ?></span> 
          <span itemprop="reviewCount"><?php echo $array["reviews_count"]; ?></span>
         </div>
        <?php endif; ?>
        <!-- Yotpo's Rich Snippets END -->

        Example:

        <?php $array = $this->helper('yotpo/richSnippets')->getRichSnippet($this); ?>
        <?php if ($array["reviews_count"] != 0 ): ?>
         <div style="display:none" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
          <span itemprop="ratingValue"><?php echo $array["average_score"]; ?></span> 
          <span itemprop="reviewCount"><?php echo $array["reviews_count"]; ?></span>
         </div>
        <?php endif; ?>
        Please note:
        Data is cached in the Adobe Commerce database for 24 hours to maintain a better user experience.
        After this code is added to the product page template and the product page is loaded/viewed for the first time, a record will be created in the Adobe Commerce database for the specific product.

        Product markup

        Need help?

        If you need assistance with manual markup, please refer to these resources:

        The mandatory properties in the markup language and the way they should be nested is as follows:

        itemscope itemtype="http://schema.org/Product"
        | itemprop="name"
        | itemprop="offers" itemscope itemtype="http://schema.org/Offer"
        | ++ itemprop="price"
        | ++ itemprop="priceCurrency"
        | itemprop="aggregateRating" itemscope
        itemtype="http://schema.org/AggregateRating"
        | ++ itemprop="ratingValue"
        | ++ itemprop="reviewCount"

        Manual markup Rich Snippets troubleshooting

        Manual markup

        When you install the plug-in, Yotpo creates a table named yotpo_rich_snippets. This table holds your products' aggregate rating data used by Google's Rich Snippets. If you are using a DB prefix for your store, this table should be created with the same prefix.

        If you're having trouble with the rich snippets functionality, verify that the table was created correctly and that it holds valid values in the average_score and reviews_count columns. If this is not the case, please contact Yotpo Support.

        Validation

        Please note:
        The product must have at least one review for the testing tool to work or for ratings to appear.

        Test the markup on Google Structured Data Testing Tool. The result should look like this:

        Google Crawling

        If you have marked up your page correctly and it shows the stars in the Google testing tool, keep in mind that you will need to wait approximately 24 hours for it to be indexed by Google. The waiting time depends on Google.

        Google makes algorithmic determinations on when and how to display results in the SERPS (search engine results page), including snippet information, based on a myriad of factors including the search terms, etc. Even if they are coded correctly, snippet inclusion in the SERPS is beyond Yotpo's direct control.

        We would recommend focusing your efforts on making as unique and compelling a site as possible in order to increase the likelihood of your products reviews displaying in the Google search.

        Manipulating or changing your aggregateRating markup may lead to Google penalizing your Rich Snippets results. 



        Was this article helpful?