• Resolved fredctb

    (@fredctb)


    Hello

    I have Plugin Woocommerce + Stamped io (reviews) + child theme Storefront

    For integrate Rich snippet , Stamped io let me instructions :
    https://help.stamped.io/article/8-getting-started—woocommerce

    1) Find these codes in “woocommerce/includes/class-wc-structured-data.php”
    2) Add these codes directly above:

    My problem is if woocommerce update i will lost this shortcode on “woocommerce/includes/class-wc-structured-data.php”
    Answer of stamped io : “Yes, whenever the update is done, you do need to reinstall the rich snippet codes”

    Could I put this shortcode on Child theme/woocommerce ?

    Thanks for reply

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @fredctb

    You could copy the template file to your theme but we can’t support the customizations:

    https://docs.woocommerce.com/document/template-structure/

    You’ll likely have to just add the code with each update you apply.

    Stef

    (@serafinnyc)

    There’s an easier way. You could use a custom field. Do your structure data markup and if you plan on using JSON then I suggest adding a php snippet in the header.

    Add this

    <?php
    $schemamarkup = get_post_meta(get_the_ID(), 'schemamarkup', true);
    if(!empty($schemamarkup)) {
      echo $schemamarkup;
    }
    ?> 

    Then add your markup
    Example:

        <script type="application/ld+json">
    {
      "@context": "https://schema.org/",
      "@type": "Product",
      "name": "Executive Anvil",
      "image": [
        "https://example.com/photos/1x1/photo.jpg",
        "https://example.com/photos/4x3/photo.jpg",
        "https://example.com/photos/16x9/photo.jpg"
       ],
      "description": "Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.",
      "sku": "0446310786",
      "mpn": "925872",
      "brand": {
        "@type": "Thing",
        "name": "ACME"
      },
      "review": {
        "@type": "Review",
        "reviewRating": {
          "@type": "Rating",
          "ratingValue": "4",
          "bestRating": "5"
        },
        "author": {
          "@type": "Person",
          "name": "Fred Benson"
        }
      },
      "aggregateRating": {
        "@type": "AggregateRating",
        "ratingValue": "4.4",
        "reviewCount": "89"
      },
      "offers": {
        "@type": "Offer",
        "url": "https://example.com/anvil",
        "priceCurrency": "USD",
        "price": "119.99",
        "priceValidUntil": "2020-11-05",
        "itemCondition": "https://schema.org/UsedCondition",
        "availability": "https://schema.org/InStock",
        "seller": {
          "@type": "Organization",
          "name": "Executive Objects"
        }
      }
    }
    </script>
    

    However, if you are really good at understanding code I would use Google Tag manager and use dynamic variables. Because this way you’d have to change the verbiage, price every time you change the front end price and description, etc.

    Hope that helps.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Rich snippet without plugin’ is closed to new replies.