How to add product structured data to your Shopify homepage for Rich Results
With JSON-LD for SEO you can add a single product’s structured data to your homepage.
This is designed for Shopify stores that only have one product or one primary product that they feature on the homepage.
If you have multiple products listed on the homepage or in your store, you’re probably best served by the standard behavior of JSON-LD for SEO. That’s where the product data is added to each individual product page.
Required guidelines
Before I show you how to do this though, one warning.
You must make sure your homepage meets Google’s Structured Data guidelines. Failure to do so may result in Google ignoring the data on your homepage or removing any Rich Results for your store. The guidelines aren’t complex but they are important.
Decide on which product to use
In order to add the data for a product, JSON-LD for SEO needs to know which product. This is done by the product handle.
The product handle is the identifier for the product that’s used in URLs, your theme, and various other places. The easy way to find it is to extract it from the URL for the product.
For example:
- https://myshopify.com/products/red-hat would have the handle of
red-hat
- https://myshopify.com/collections/spring-wear/products/green-dress would have the handle of
green-dress
- https://myshopify.com/collections/spring-wear/products/green-dress?variant=11111 would still have the handle of
green-dress
Configuring the metafield
Once you’ve met the guidelines and selected which product to use, you’ll need to add a Shopify metafield to tell JSON-LD for SEO which product to feature. Pick your favorite metafield tool of choice, it doesn’t matter which.
Add the following metafield to your Store.
- Namespace:
jsonld
- Key:
product_on_homepage
- Value:
your product handle
e.g.green-dress
Testing the Product Schema
Once that metafield has been created and saved, you can use Google Rich Results Testing Tool to verify the data is correct. You should be able to see a set of Product data that matches the product you selected.
It will take some time before Google updates its results to include your homepage’s Rich Result but if everything works well, it’ll be worth it.
JSON-LD for SEO
Get more organic search traffic from Google without having to fight for better rankings by utilizing search enhancements called Rich Results.