How to add Schema Markup to Shopify

Last updated:

Home » Articles » Shopify » How to add Schema Markup to Shopify

What is Schema?

Schema markup is like a secret language for your website that helps search engines understand what your content is all about. If you’re running an online store with Shopify, adding this special code can be a game-changer.

Imagine you’re searching for a product online. You want to see details like price, reviews, and if it’s in stock. Schema markup makes sure all that info pops up right there in the search results. By adding schema markup into your Shopify store, you’re basically giving search engines all the information they need to find and showcase your products, rather than making them dig through your entire product page. When more people can see what you’re selling, it’s like opening the floodgates to more potential customers and, hopefully, more sales.

Schema markup has become even more critical with the rise of AI search engines and Google’s increased emphasis on structured data for e-commerce rich results.

So, are you already using schema markup on your Shopify store? If not, don’t worry. Our article will guide you through the process step by step, making it as easy as pie.

Before you start: check your current theme

Many Shopify themes already include basic schema markup, particularly for product pages. The Dawn theme (Shopify 2.0) now includes comprehensive product schema in recent versions. However, the implementation varies across themes and may not include all useful data like ratings, return policy, or shipping details. Always audit your existing structured data using Google’s Rich Results Test before adding more, to avoid duplication.

Important Note: Always audit your existing structured data using Google’s Rich Results Test before adding more, to avoid duplication. Many modern themes include the structured_data Liquid filter for basic JSON-LD output.

How to add Schema to your Shopify website

It’s not complicated adding schema markup to your Shopify. You can do it manually or you can use a third-party Shopify app. Let’s start with the manual approach first.

Replacing default schema with enhanced markup

Instead of simply adding more schema, you can replace the default theme schema with an enhanced version that includes more detailed product information.

Important: Avoid using non-standard schema types. Use “ProductGroup” for multiple variants instead of deprecated “ProductGroup” variations.

Step 1: Create a comprehensive schema markup that includes additional attributes such as shipping details, return policies, and proper handling of product variants.

Step 2: Replace static values with Shopify Liquid variables to make your schema dynamically reflect your actual product data:

<script type="application/ld+json">
{
  "@context": "https://schema.org/",
  "@type": "{% if product.variants.size > 1 %}ProductGroup{% else %}Product{% endif %}",
  "name": "{{ product.title | escape }}",
  "description": "{{ product.description | strip_html | escape }}",
  "image": [
    "{{ product.featured_image | img_url: 'master' }}"
    {% for image in product.images limit: 5 %}
      ,"{{ image | img_url: 'master' }}"
    {% endfor %}
  ],
  "sku": "{{ product.variants.first.sku | escape }}",
  "brand": {
    "@type": "Brand",
    "name": "{{ product.vendor | escape }}"
  },
  {% if product.variants.size > 1 %}
  "variesBy": [
    {% for option in product.options %}
      "{{ option | escape }}"{% unless forloop.last %},{% endunless %}
    {% endfor %}
  ],
  "hasVariant": [
    {% for variant in product.variants %}
    {
      "@type": "Product",
      "name": "{{ product.title | escape }} - {{ variant.title | escape }}",
      "sku": "{{ variant.sku | escape }}",
      "offers": {
        "@type": "Offer",
        "priceCurrency": "{{ shop.currency }}",
        "price": "{{ variant.price | money_without_currency | remove: ',' }}",
        "availability": "{% if variant.available %}https://schema.org/InStock{% else %}https://schema.org/OutOfStock{% endif %}",
        "url": "{{ shop.url }}{{ product.url }}?variant={{ variant.id }}"
      }
    }{% unless forloop.last %},{% endunless %}
    {% endfor %}
  ],
  {% endif %}
  "offers": {
    "@type": "{% if product.variants.size > 1 %}AggregateOffer{% else %}Offer{% endif %}",
    "priceCurrency": "{{ shop.currency }}",
    {% if product.variants.size > 1 %}
    "lowPrice": "{{ product.price_min | money_without_currency | remove: ',' }}",
    "highPrice": "{{ product.price_max | money_without_currency | remove: ',' }}",
    "offerCount": "{{ product.variants.size }}",
    {% else %}
    "price": "{{ product.price | money_without_currency | remove: ',' }}",
    {% endif %}
    "availability": "{% if product.available %}https://schema.org/InStock{% else %}https://schema.org/OutOfStock{% endif %}",
    "url": "{{ shop.url }}{{ product.url }}",
    "shippingDetails": {
      "@type": "OfferShippingDetails",
      "shippingRate": {
        "@type": "MonetaryAmount",
        "value": "0",
        "currency": "{{ shop.currency }}"
      },
      "deliveryTime": {
        "@type": "ShippingDeliveryTime",
        "handlingTime": {
          "@type": "QuantitativeValue",
          "minValue": 0,
          "maxValue": 1,
          "unitCode": "DAY"
        },
        "transitTime": {
          "@type": "QuantitativeValue",
          "minValue": 1,
          "maxValue": 5,
          "unitCode": "DAY"
        }
      }
    },
    "hasMerchantReturnPolicy": {
      "@type": "MerchantReturnPolicy",
      "applicableCountry": "US",
      "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow",
      "merchantReturnDays": 30,
      "returnMethod": "https://schema.org/ReturnByMail",
      "returnFees": "https://schema.org/FreeReturn"
    }
  }
  {% comment %} Add aggregateRating only if you have genuine reviews {% endcomment %}
  {% if product.metafields.reviews.rating and product.metafields.reviews.count %}
  ,"aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "{{ product.metafields.reviews.rating }}",
    "reviewCount": "{{ product.metafields.reviews.count }}"
  }
  {% endif %}
}
</script>

Step 3: Locate and replace the existing schema markup:

1. Navigate to Online Store > Themes > Edit code
2. For Dawn theme: Open the product.liquid or main-product.liquid file. For older themes: Look in product-form.liquid or similar files
3. Search for “structured_data” or look for an existing

<script type="application/ld+json"> tag

4. Replace the entire script block with your enhanced version
5. Save the changes

Add schema code to your site manually

Step 1: Access theme files

  • Log in to your Shopify admin panel.
  • Navigate to “Online Store” and then “Themes.”
  • Click on “Actions” and select “Edit code” to access the theme files.

Step 2: Locate .liquid template

In this step, you have to find the right .liquid template in your Shopify theme where you want to add the Schema markup.

For Shopify 2.0 themes (Dawn, etc.):

  • Product pages: sections/main-product.liquid or templates/product.liquid
  • Collection pages: sections/main-collection.liquid
  • Article pages: sections/main-article.liquid

For legacy themes:

  • Product pages: templates/product.liquid
  • Collection pages: templates/collection.liquid
  • Article pages: templates/article.liquid

This can include files like the main theme file, a product page template, a collection page template, and so on.

Step 3: Create JSON-LD Schema Markup

Next, you can use Google’s Rich Results Test to create Schema markup using the JSON-LD format.

Step 4: Validate Schema Markup

Make sure your Schema markup is error-free by checking it with tools like Google’s Structured Data Testing Tool or Schema Markup Validator. This helps ensure that your structured data is correctly formatted and ready for search engines to understand.

the homescreen of schema markup validator

Step 5: Add Schema to Liquid Template

Last but not least, place the JSON-LD Schema markup in the right spot in your chosen Liquid template. Typically, this involves adding it in either the header or body section, depending on the type of Schema markup you are using.

Best Practice: Add it in the <head> section or just before the closing </body> tag, depending on the type of Schema markup you are using.

Sample of JSON-LD Schema Markup

To assist your work, feel free to copy and use the sample schema markup for each type.

Schema Markup: Product

{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "Example Product",
  "description": "This is an example product description",
  "sku": "12345",
  "image": ["https://example.com/product-image.jpg"],
  "brand": {
    "@type": "Brand",
    "name": "Example Brand"
  },
  "offers": {
    "@type": "Offer",
    "price": "100.00",
    "priceCurrency": "USD",
    "availability": "https://schema.org/InStock",
    "url": "https://example.com/product-page",
    "shippingDetails": {
      "@type": "OfferShippingDetails",
      "shippingRate": {
        "@type": "MonetaryAmount",
        "value": "0",
        "currency": "USD"
      },
      "deliveryTime": {
        "@type": "ShippingDeliveryTime",
        "handlingTime": {
          "@type": "QuantitativeValue",
          "minValue": 0,
          "maxValue": 2,
          "unitCode": "DAY"
        },
        "transitTime": {
          "@type": "QuantitativeValue",
          "minValue": 3,
          "maxValue": 7,
          "unitCode": "DAY"
        }
      }
    },
    "hasMerchantReturnPolicy": {
      "@type": "MerchantReturnPolicy",
      "applicableCountry": "US",
      "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow",
      "merchantReturnDays": 30,
      "returnMethod": "https://schema.org/ReturnByMail",
      "returnFees": "https://schema.org/FreeReturn"
    }
  }
}

Schema Markup: ProductGroup (for variants)

{
  "@context": "https://schema.org",
  "@type": "ProductGroup",
  "name": "Example T-Shirt Collection",
  "description": "Available in multiple colors and sizes",
  "variesBy": ["color", "size"],
  "hasVariant": [
    {
      "@type": "Product",
      "name": "Red T-Shirt - Large",
      "sku": "TSHIRT-RED-L",
      "color": "Red",
      "size": "Large",
      "offers": {
        "@type": "Offer",
        "price": "25.00",
        "priceCurrency": "USD",
        "availability": "https://schema.org/InStock"
      }
    }
  ]
}

Schema Markup: Member Program (for loyalty programs)

{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "Your Store",
  "hasOfferCatalog": {
    "@type": "OfferCatalog",
    "name": "VIP Member Benefits",
    "itemListElement": [
      {
        "@type": "Offer",
        "name": "Free Shipping",
        "description": "Free shipping on all orders for VIP members",
        "category": "Shipping"
      },
      {
        "@type": "Offer",
        "name": "10% Discount",
        "description": "Exclusive 10% discount on all products",
        "category": "Discount"
      }
    ]
  }
}

Schema Markup: AggregateRating

Only use this if you have genuine, visible customer reviews on your product pages.

{
  "@context": "https://schema.org",
  "@type": "AggregateRating",
  "itemReviewed": {
    "@type": "Product",
    "name": "Example Product"
  },
  "ratingValue": "4.5",
  "bestRating": "5",
  "worstRating": "1",
  "ratingCount": "100",
  "reviewCount": "50"
}

Schema Markup: Breadcrumb

{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "Home",
      "item": "https://example.com/home"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "Category",
      "item": "https://example.com/category"
    },
    {
      "@type": "ListItem",
      "position": 3,
      "name": "Subcategory",
      "item": "https://example.com/subcategory"
    }
  ]
}

Schema Markup: Article

{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "Article Headline",
  "datePublished": "2022-01-01",
  "author": {
    "@type": "Person",
    "name": "Jane Doe"
  },
  "publisher": {
    "@type": "Organization",
    "name": "Example Publisher",
    "logo": "https://example.com/logo.png"
  }
}

Schema Markup: Organization

{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "Example Organization",
  "url": "https://example.com",
  "logo": "https://example.com/logo.png",
  "contactPoint": {
    "@type": "ContactPoint",
    "telephone": "+123456789",
    "contactType": "customer service"
  },
  "hasMerchantReturnPolicy": {
    "@type": "MerchantReturnPolicy",
    "applicableCountry": "US",
    "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow",
    "merchantReturnDays": 30,
    "returnMethod": "https://schema.org/ReturnByMail",
    "returnFees": "https://schema.org/FreeReturn"
  }
}

Using apps from Shopify store

Adding schema markup through an app in your Shopify store is super easy. Here’s a simple guide to do it:

  • Step 1: Log in to your Shopify dashboard.
  • Step 2: Go to the Shopify App Store. 

Step 3: Once set up, apps will start adding schema markup to your store’s pages automatically with enhanced features like:

  • AI-powered content optimization
  • Automatic Google policy compliance
  • Real-time validation and error fixing
  • Performance monitoring and reporting

Just make sure your theme doesn’t already include structured data to avoid duplication.

Best Practice: Use Google’s Rich Results Test to verify proper implementation after app installation.

International and Multilingual Implementation

Critical for Global Stores: If you operate in multiple countries or languages, follow these enhanced schema guidelines:

Multi-Language Schema Implementation

{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "{{ product.title | escape }}",
  "description": "{{ product.description | strip_html | escape }}",
  "inLanguage": "{{ request.locale.iso_code }}",
  "offers": {
    "@type": "Offer",
    "priceCurrency": "{{ cart.currency.iso_code }}",
    "price": "{{ product.price | money_without_currency | remove: ',' }}",
    "hasMerchantReturnPolicy": {
      "@type": "MerchantReturnPolicy",
      "applicableCountry": "{{ localization.country.iso_code }}",
      "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow",
      "merchantReturnDays": 30
    }
  }
}

Note:

  • Always specifyapplicableCountry in return policies (now required)
  • Use proper currency codes based on customer location
  • Localize shipping information with region-specific delivery times
  • Implement hreflang alongside schema for international SEO

Extra tips after adding schema markup

Adding this special code isn’t a one-and-done deal. To keep your store looking good in search results:

  • Check your code regularly, especially after making changes to your store
  • Monitor using Google Search Console > Enhancements
  • Stay up to date with schema.org vocabulary changes
  • Look out for new types of code you could add
  • See what your competitors are doing and make sure you’re keeping up

What is structured data in Shopify?

Structured data in Shopify refers to a standardised format of providing information about a webpage and its content to search engines. It’s a way of organising and labelling content on your Shopify store so that search engines, AI systems, and other automated tools can better understand and display it in search results, voice assistants, and other digital platforms.

The importance of detailed product information

When you’re adding this special code to your products, don’t just stick to the basics. The more accurate and comprehensive info you provide, the better your results. Include things like:

  • A good description of what the product is
  • What it’s made of
  • Sizes available
  • Sustainability information (increasingly important)
  • Care instructions and usage guidelines
  • Colors you offer
  • Tech specs for gadgets
  • Book details like ISBN numbers
  • Who made it (the brand)
  • Whether it’s in stock
  • What customers think about it
  • Energy efficiency ratings where applicable

Search engines love it when customers interact with your store. You can show this interaction using schema markup.

  • Authentic customer reviews only (fake reviews trigger penalties)
  • Display overall ratings for products
  • Highlight comments on your blog posts
  • List common questions and answers
  • Expert reviews and editorial ratings

Google now penalizes sites with fake or misleading review data. Only include review schema if you have genuine, verifiable customer feedback visible on your pages.

How does structured data work in Shopify?

It functions by embedding specific code into your store’s pages. This code acts as a guide for search engines, helping them understand the content and context of your pages. Few notes to remember:

  1. You or a third-party app add structured data to your Shopify theme files.
  2. Search engines scan your site and read the structured data during their regular crawling process.
  3. The search engines use this data to better understand what your pages are about and how they should be categorised.
  4. Based on the structured data, search engines may create rich snippets in search results. These can include additional information like product ratings, prices, or availability.
  5. By providing clear, structured information about your content, you increase the likelihood of appearing in relevant searches and potentially in featured snippets.

The types of Schema Markup that should be added to Shopify

To get more customers to click on your Shopify site, focus on adding special codes (schema markup) to your most important pages. Here are the five key pages and the types of schema markup you should use:

Product Pages

  • Schema Markup: Product, Review, AggregateRating
  • Why: These pages show details about your products. The special codes help display info like price, availability, and reviews right in the search results, catching people’s eyes and making them more likely to click.

Category Pages

  • Schema Markup: Breadcrumb
  • Why: This code helps show the path or location of pages on your site in the search results. It makes it easier for customers to understand your site layout and find products faster.

Blog Pages

  • Schema Markup: Article
  • Why: Blog posts can boost your site’s visibility on search engines and offer valuable info to customers. This code makes your blog posts stand out in search results with details like title, author, and publication date.

Homepage

FAQ

If I add incorrect schema markup to my Shopify store, does it hurt SEO?

Incorrect schema markup can hurt your SEO. If search engines find mistakes in your markup, it can lead to penalties, showing incorrect details in search results, or even removing your store from special search features. Always follow the guidelines from schema.org and regularly check your schema to make sure it’s working properly and boosting your SEO.

I have an international shopify store. How do I add localised schema markup for different languages?

For stores with multiple languages, use hreflang tags to tell search engines about different language versions. Add schema markup that matches the localised content for each language. You can set up your Shopify store to generate the correct JSON-LD markup based on the user’s language settings or different subdomains for each region.

Struggling to add schema markup to your store?

Don’t waste time it out alone. Our team at Kahunam will do it for you, helping Google understand your store better and show up more in searches. Book a free consultation to talk with Shopify expert.

Leave a comment

Wave

Enjoy our articles? Join our free list and get more.

Sign Up

Book a Discovery Call