Structured Data for Shopify: The Definitive Guide [2020]

Structured Data for Shopify: The Definitive Guide [2020]

This post was originally published in June, 2019. Last updated: February, 2020.

A screenshot of a Google search results page, May 31, 2019

This is a rich result (aka a rich snippet). Rich results display more data than regular search results. For example, while regular results display only a page’s title, URL, and meta description, rich results can also display product ratings, number of reviews, price ranges, and more (as shown in the screenshot above).

Since you’re here, you probably want Google (and other search engines) to display similar results for your Shopify store. For this to happen, you have to add structured data markup to your website, which can be a hassle.

You need to be tech-savvy. You need to be familiar with Shopify Liquid, HTML, JSON-LD (JSON for Linking Data), and schema.org (data types and properties). But even if you are a skilled developer, you might find it difficult to define exactly what data types and properties you need to add to your Shopify store.

As Shopify experts, we are helping Shopify merchants add structured data to their stores through our Smart SEO app and through our customization services on a daily basis. In this article, we will summarize our experience and share the knowledge we’ve gained. We will talk about what structured data is and how you can implement it. We will also tackle the specific schema.org data types and properties you should add to your Shopify homepage, product, collection, blog and article pages.

After you read this guide, you will realize that implementing structured data, intimidating at first glance, can be quite straightforward as long as you have the right information.

What you'll learn

What is structured data & how can it benefit you?

This is structured data markup:


A screenshot of shop.vanillapup’s HTML, February 6, 2020. To see the HTML of a page, right click (anywhere on the page) and select the ‘View Page Source’ option from the drop-down menu.

And this is the result of implementing structured data markup:


Structured data markup gives search engines more information about your website and its content. In the context of e-commerce, structured data can provide Google with valuable information about your products (e.g. pricing, availability, rating, number of reviews, etc.). It can also give detailed information about your business (e.g. logo, address, contact information, connected social media pages, founders, subsidiaries, etc.).

Why is it important that Google has such information?

To paraphrase the question: how can structured data benefit you? Structured data allows search engines and web systems to read and better understand what your website is about. In this way, Google can present your products (and other web pages) in a more detailed and reliable manner. One important aspect of this is that Google uses structured data to create rich snippets. Google can also use the markup for your product pages to create automated product feeds for your Google Shopping Ads.


Google does not guarantee that you will get rich snippets even if your pages are marked up correctly. This is explicitly stated in Google’s Structured Data Guidelines:


But if you add structured data markup to your website, Google is more likely to give you rich snippets and in most cases it does.

Structured data formats & schemas

Structured data formats

As described in the Google Webmaster Blog, structured data formats “define a small number of fixed structures that can be used to encode descriptive data”.

There are 3 structured data formats:

  • JSON-LD
  • RDFa
  • Microdata

Google recommends using JSON-LD for structured data.


Source: Google, Understand how structured data works

The takeaway: If you’re using Microdata or RDFa, it is best to consider migrating to JSON-LD. JSON-LD is easier to add and update and it is compatible with dynamic data. In addition, if you use JSON-LD, you don’t have to change your HTML code to indicate where the structured data is (read more).

Structured data schemas

Structured data schemas define terms for different types (e.g. “WebSite”, “Person”, “Organization”) and properties (e.g. “name”, “description”, “logo”). Structured data schemas include:

Data-vocabulary.org is outdated. And, due to the increasing popularity of schema.org, come April 6, 2020, data-vocabulary.org will no longer be eligible for rich results features.



Learn more: Sunsetting support for data-vocabulary

The takeaway: If you’re using data-vocabulary.org, you must replace your data-vocabulary.org markup with schema.org markup.

Now that you know what structured data is, why you should use it and what is Google’s preferred structured data format (JSON-LD) and schema (schema.org), let’s take a closer look at what you need to do before you implement structured data.

Before you implement structured data

You must do 3 things:

  • Define your main page types. For Shopify, the main page types are homepage, collection, product, blog, and article pages.
  • Define what schema.org types and properties you must add to each page of your Shopify website: homepage, product pages, collection pages, blog page, and article pages. For example, this is how the structured data markup for a product page should look:


Source: schema.org, Product, Example 2, JSON-LD

As you can see from the screenshot, structured data consists of types. Each type is associated with a set of properties. Common properties of the Product type include productID, description, name, height, weight, mpn, etc.

Each type can contain other types (arranged in hierarchical order). For example, the Product type contains a set of Offer types. The Offer types are actually your product variants and contain properties like price, availability, etc.

The core vocabulary [of schema.org] currently consists of 615 Types, 901 Properties, and 114 Enumeration Values.

We’re only interested in a handful of them. But before we get to the actual types and properties you need to add to your store’s individual pages, let’s see how you can implement structured data in your website’s HTML.

How to add structured data to your Shopify store?

There are 3 ways to implement structured data in your website’s HTML:

  • You can use a Shopify SEO app like Smart SEO - Smart SEO automatically provides Google (and other search engines) with detailed structured data in JSON-LD format. For example, it generates structured data for every product on your collection pages. As a result, the app helps you get rich snippets and rank higher on the SERPs. Smart SEO sports a 4.9/5 rating, costs only $4.99/month and you can take it for a 7-day free spin!

Note that there are a handful of apps on the Shopify App Store that can add structured data to your store. We recommend that you use only one at a time. Otherwise, you may end up with a mess of duplicate structured data which can hurt your rankings.

  • You can do it manually. For this to happen, you must be familiar with Shopify Liquid, JSON-LD (and JSON for that matter), HTML, and schema.org. If you’re not a skilled developer (or don’t have one in-house), we don’t recommend this option because of the possibility of introducing errors to your website’s HTML. Instead...
  • You can work with a certified Shopify expert and outsource the rask. We offer an SEO service which includes an SEO audit, structured data optimization, meta tags optimization, link optimization, and more. If you're interested in working with us, or want to learn more, do not hesitate to contact us. We'd be happy to help!

Now that you know your options for implementing structured data in your Shopify store’s HTML, let’s take a closer look at the different schema.org data types and properties you need to add to the different pages of your website.

What structured data markup to add to your Shopify homepage?

You should add 2 data types to your homepage:

WebSite

Schema.org defines ‘WebSite’ as a set of related web pages that usually share the same domain. You have to include the following properties in the WebSite data type:

  • url - your website’s URL
  • target - “Indicates a target EntryPoint for an Action” (source: schema.org)
  • query-input - this is a text search deep link with -input that inlines “the resulting value of -input properties into action URLs” (source: schema.org)

Example: BeachCandy Swimwear, structured data generated with Smart SEO

Here’s BeachCandy Swimwear’s review of our app:

Read more Smart SEO reviews

Organization

For example, Store, SportsOrganization, Corporation, LocalBusiness, BikeShop, BookStore, WorkersUnion, HardwareStore, etc. Note that the more specific the Organization type is, the better. You have to include the following properties in the Organization data type:

  • name - your Shopify store or website's name
  • url - your website's URL
  • description - a description of your business (who you are, what you do/sell, how your product/service benefits customers, etc.)
  • logo - Google displays your logo in search results and in the Knowledge Graph (read full definition)
  • image
  • sameAs - links to your social media profiles (Facebook business page, Twitter profile, YouTube account, Instagram account, etc.)
  • address (PostalAddres) - streetAddress (street and number), addressLocally (city), postalCode, address Country (country)

You can also include a price range (priceRange), contact information (e.g. a phone number), geolocation, and more.

Example: Alexander Palm Photography, structured data generated with Smart SEO

Here's Alexander's review of our app:

Read more Smart SEO reviews

    What structured data markup to add to your Shopify product pages?

    You should add 3 data types to your product pages:

    The Product type describes the product itself and the Offer type describes a product variant with its price, sku, barcode, etc. You need to have one Product type and at least one Offer type for each product variant. If you do not have variants for a product, you will have the price, sku, barcode, etc. as properties of that product. These properties are added as a default variant in Shopify and you can use this variant to create your Offer type.

    Product

    Product data type (required properties):

    • name - product name
    • image - imageObject or URL of the product photo
    • offers - product variants

    Product data type (recommended properties):

    • productID
    • aggregateRating - the average review score of the product
    • brand
    • description
    • review
    • sku - a unique Stock Keeping Unit of the product
    • gtin8 / gtin13 / gtin 14 / mpn / isbn - global identifiers, or unique product identifiers

    It is important that you have the following recommended attributes: productID, brand, mpn (Manufacturer Part Number, MPN), and gtin (Global Trade Item Number, GTIN). This will help Google match search queries with your products.

    In Shopify, the GTIN is referred to as barcode and you can add it to your product variants. The GTIN is also your productID and can also serve as an MPN. Note that Smart SEO outputs the barcode for the productID, gtin and the mpn properties.

    Offer

    Offer data type (required properties):

    • availability (e.g. InStock, OutOfStock)
    • price
    • priceCurrency

    Offer data type (recommended properties):

    • itemOffered
    • priceValidUntil (in ISO 8601 date format)
    • url (the URL of the product page)
    • itemCondition
    • sku

    Example: The Dove Factor, structured data generated with Smart SEO

    Here's The Dove Factor's review of our app:

    Read more Smart SEO reviews

    BreadcrumbList

    It is a good practice to add breadcrumb markup to your product pages. This will help Google better understand and categorize the information from your product pages. The breadcrumb markup should contain the BreadcrumbList type. The BreadcrumbList type should contain at least one ListItem type. The ListItem type should contain the following properties:

    • position
    • item
    • id
    • name

    Here’s an example of breadcrumb markup generated with Smart SEO (Spyder Industries).

    And here’s Spyder Industries’ review of our app:

    Read more Smart SEO reviews, or learn more about breadcrumb markup: schema.org - BreadcrumbList, Google Developers - Breadcrumb

    What structured data markup to add to your Shopify collection pages?

    The collection page should contain the CollectionPage type and also include one ListItem type for each product on the collection page.

    CollectionPage

    The CollectionPage type should contain the following properties:

    • name - the name of the collection page
    • url - the URL of the collection page
    • description - description of the collection page
    • image - the main image of the collection page

    Example: shop.vanillapup, structured data generated with Smart SEO


    Here’s Shop Vanillapup’s review of our app:


    Read more Smart SEO reviews

    ListItem

    The ListItem type should contain the following properties:

    • position - the position of the product on the collection page, i.e. if the product is displayed third, the position value would be “3”
    • url - the URL of the product page

    Example: Victorian Ladies, structured data markup generated with Smart SEO


    And here's Victorian Ladies' review of our app:


    Read more Smart SEO reviews


    It is also a good practice to add breadcrumb markup to your collection pages (please, check the Product page markup section for more information on breadcrumb markup).

    What structured data markup to add to your Shopify blog page?

    You should add only one data type to your blog page - Blog, - and include the following properties in your blog markup:

    • about - a description of your blog; the subject of the blog (e.g. e-commerce, Shopify, your product or service, etc.), how can it help readers, etc.
    • name - the name of your blog
    • url - the URL of your blog
    • keywords - the keywords you target

    The Blog type should contain a number of BlogPosting types. Each BlogPosting type is associated with an article or a publication. The BlogPosting type should contain the following properties:

    • headline
    • mainEntityOfPage - the canonical URL of the page
    • image (ImageObject)
    • url - the URL of the page
    • datePublished
    • dateModified
    • dateCreated
    • description - a description or an excerpt of the blog post
    • author
    • publisher
    • logo (publisher logo)
    • url (publisher URL)
    • name (publisher name)

    Example: Tiny Tots Baby Store, structured data generated with Smart SEO


    And here's Tiny Tots Baby Store's review of our app:


    Read more Smart SEO reviews

    What structured data markup to add to your Shopify article pages?

    Article pages in Shopify should have the Article type. The Article type should contain the following properties:

    • about - the subject of the article
    • headline - the headline of the article
    • mainEntityOfPage
    • image - the cover image of the article
    • url - URL of the article
    • dateModified
    • datePublished
    • dateCreated
    • description - a description or an excerpt of the article
    • articleBody - the body of the article
    • author
    • publisher
    • logo (publisher logo)
    • name (publisher name)

    Example: Tiny Tots Baby Store, structured data generated with Smart SEO

    Testing your structured data markup

    You can use the following tools to check if your pages are marked up correctly and you’re eligible for rich results:

    Google Structured Data Testing Tool

    The structured data testing tool allows you to test URLs or code snippets:

    I’ll use Tiny Tots Baby Store to show you how the tool works. To check if the website is marked up correctly, all I have to do is paste its URL in the “Enter a URL” field and click “Run Test”.

    Everything looks great here - 0 errors, 0 warnings, and 3 items scanned.

    You can expand any of the data types (in this case WebSite, Store (Organization), and ToyStore) and see their properties.

    Note that if the Structured Data Testing Tool detects an error, you must fix it as it might (and probably will) hurt your rankings. Warnings, on the other hand, are not something you should lose sleep over - usually, warnings refer to recommended properties you could include in your markup.

    Rich Results Test

    Rich Results Test is just as easy to use. All you have to do is paste your website’s URL in the “Enter a URL to test” field → Click “Test URL”.

    Wait a few seconds...

    Et voila!

    Note that you can also test code snippets.

    Wrap-up

    Adding structured data markup to your Shopify store will help search engines understand better what your website is about. It will also increase your chances of getting rich results which, in turn, will increase user engagement and your CTR - all leading to more sales.

    There are 3 structured data formats: JSON-LD, RDFa, and Microdata. Google prefers and recommends using JSON-LD for structured data.

    There are 2 structured data schemas (or vocabularies): data-vocabulary.org and schema.org. Data-vocabulary.org is outdated and, as of April 6, 2020, it will no longer be eligible for rich results features. Thus, if you’re using data-vocabulary.org markup, you must replace it with schema.org markup.

    Structured data markup (or schema.org markup) consists of data types and properties arranged in hierarchical order. In Shopify, it is recommended that you add structured data to your homepage, product pages, collection pages, blog page, and article pages. Here is a brief overview of the data types and properties you should add to each of these pages:

    There are 3 ways to add structured data to your Shopify store: you can use a Shopify SEO app like Smart SEO, you can do it manually in-house, or you can outsource the task to a Shopify Expert. If you’d like us to take a look at your website’s SEO and implement structured data for you, don’t hesitate to contact us!

    After you add structured data to your website, you have to check if your pages are marked up correctly. To do this, you can use Google Structured Data Testing Tool and/or Rich Results Test. Making sure that your pages are marked up correctly is the last step of implementing structured data.

    Your turn!

    We realize that this is a lot of information to take in at once and you must have a lot of questions. We’re here to answer all of them!

    How will you add structured data markup to your website? Will you use an app, will you do it in-house, or outsource it to a Shopify Expert?

    Or, maybe, you’ve already added structured data and want to share your experience...

    Whatever it is, just leave a comment below!

          Share

          Leave a comment

          • Radostina @ Sherpas Design

            Hello, Megan!
            The easiest way to apply templates for JSON-LD structured data is to use our Smart SEO app (https://apps.shopify.com/smart-seo). It automatically generates detailed structured data (for example, the app generates structured data for every product on your collection pages). The app has a 7-day free trial. Please, let us know if you have further questions :)

            Best,
            Radostina @ Sherpas Design

          • Megan

            Hi!

            Do you have any Shopify templates for JSON that can be applied to all pages? All the examples above would need to be done individually. For example:

            { "@context": "http://schema.org/", "@type": "Product", "url": "{{ shop.url | append: '/products/' | append: product.handle }}", "name": "{{ product.title }}", "image": "{{ product.featured_image.src | img_url: 'master' }}", "description": "{{ product.description | strip_html | escape }}", {% if collection_urls != blank %} "category": [ {{ collection_urls }} ], {% endif %} "brand": { "name": "{{ product.vendor }}" }, "offers": { "@type": "Offer", "priceCurrency": "{{ shop.currency }}", "price": "{{ current_variant.price | money }}", "availability": "http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}", "seller": { "@type": "Organization", "name": "{{ shop.name }}" } } }

            In this case above, the schema is automatically added for all pages based on what information is in the product page.

            Is there a way to combine this with other pieces of json data that does need to be entered manually?

            Thanks!

          • Radostina @ Sherpas Design

            Hello, hamza!
            Thank you for the kind words! Could you please share more information about what you want to achieve – for example, which pages of your website would you want to add the structured data markup to, and what kind of rich snippets are you hoping to get?
            Best,
            Radostina @ Sherpas Design

          • hamza

            Hello sherpas,
            Nice article please let me know where do I paste this code in shopify and this will be working or not ?

          • Radostina @ Sherpas Design

            Hello, Mahiza!
            Adding CollectionPage markup will give Google (and other search engines) more detailed information about your website. If there are no errors, this can only increase your chances of getting rich snippets. It cannot hurt your rankings in any way.
            Regarding your question about the Vanillapup example: The collection page should contain the CollectionPage type and also include one Product type with an Offer for each product present on the page. In other words, if there are 10 products on the collection page, there should be 10 Product Types with an Offer.
            Regarding the Parissa example, it appears that they have deleted their CollectionPage markup after the last time we updated the article (which was in June). We don’t know why they did this, but thank you for bringing our attention to it – we will remove the example from the article so that the content is up to date!
            Best Regards,
            Radostina from Sherpas Design

          • Mahiza Moore

            Hello! I really appreciate your article. I am inquiring about the CollectionPage markup specifically. Is it best practice to add this? I haven’t seen many others blog about the CollectionPage schema code- only really the product which got my curious. Have you seen results from this?

            For the vanillapup example, i was a bit confused because you said one product and offer should go in the collection page schema but when going to the site and viewing the page source it looks like there were almost 234 products!

            Also, the parissa example, when you view page source there isn’t any collectionpage schema which threw me off. Did they remove it because they didn’t see results from it?

            Looking forward to hearing back from you

            -Mahiza