Removing the invalid structured data from your Shopify theme – microdata and JSON-LD

Recently a customer Wes emailed me a question about his Shopify theme’s microdata:

Can you tell me how to remove the theme’s microdata? That sounds like the best thing for me to do and then install your app.

When JSON-LD for SEO is installed, it provides the structured data your Shopify store needs for products, business info, blog posts, and other things.

Most of the time, that’s all you need.

But sometimes your theme also has structured data, and sometimes that structured data is broken.

You don’t need to remove your theme’s microdata unless you’re also using Google’s Merchant Center with Shopify (which is super strict about structured data).

Google Search can use multiple sets of structured data, they’ll just use the most correct and complete set they find on a page. Here’s some more details about how Google interacts with multiple sets of structured data.

But sometimes you still want to clean up your theme’s structured data. Either because it’ll be easier to understand, or to remove extra reports in Google’s Search Console, or maybe because Google Merchant Center is complaining about your theme’s microdata.

Whatever the reason, sometimes it makes sense to edit your theme and remove all of its structured data.

You will need a bit of experience with HTML so you might need to ask someone or hire someone to help if you’re unsure.

There are two types of structured data that a Shopify theme can use. The older style if called microdata and it’s structured data that’s mixed in with HTML code. The second style is more modern and is called JSON-LD.

JSON-LD is the same format that I use in my app and is Google’s recommended format, but if your theme is missing parts of its data then you still might want to remove it and replace it with my app.

Step 1. Backup

First, you’ll want to take a backup copy of your theme. Just in case.

Step 2. Find all of the microdata

Second, search through your theme for the theme’s microdata structured data. There are a few keywords you can use for this.

  • itemtype – the type of data
  • itemprop – the values of a piece of data
  • itemscope

All of these combined make up your microdata.

Step 3. Remove each piece of microdata

As you find each piece of microdata you’ll want to remove it.

Some will be attached to HTML components you want to keep, like your price display and product name. Others will be hidden elements like meta or span tags. This is where HTML expertise will help.

As you’re editing your theme you’ll want to refresh the pages in your store to make sure they still look correct.

Step 4. Find all of the JSON-LD data

Now you’ll repeat that process but for the JSON-LD formatted data. Search through your theme for ld+json (yes, it’s listed backwards but that’s how JSON-LD data is defined).

Step 5. Remove each piece of JSON-LD data

If you find some JSON-LD data, there’s be a script tag that encloses each piece. You’ll want to remove the script tags and the content inside them. For example, if you found this piece that describes a product you’d remove all of it.

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@id": "https://www.littlestreamsoftware.com/shopify-apps/json-ld-seo/#product",
  "@type": "Product",
  "brand": {
    "@type": "Brand",
    "name": "Little Stream Software"
   },
  "description": "Shopify app that to get more organic search traffic from Google for your Shopify store, without having to fight for better rankings",
  "url": "https://www.littlestreamsoftware.com/shopify-apps/json-ld-seo/",
  "name": "JSON-LD for SEO",
  "productID": "JSON-LD for SEO"
}
</script>

If you are using JSON-LD for SEO you do not want to remove its structured data code. It’s all located inside of snippets/jsonld-for-seo.liquid. If you did on accident, you can re-install that code easily from the app configuration area.

Similarly, if you’re using another app for your JSON-LD data you would not want to remove it either unless you uninstall the app or the app’s data is causing problems (e.g. with Merchant Center).

Step 6. Check and test your data

After you’ve removed the structured data, make sure to check your Shopify store. You want to make sure the pages still look and function correctly.

You’ll also want to use Google’s Structured Testing Tool on the pages to make sure you’ve removed all of the correct data.

If something doesn’t look right and you can’t fix it, restore your backup from Step 1 and try again.

If you accidentally removed JSON-LD for SEO’s data, you can have it reinstall its code using the app configuration area in your Shopify admin.

This process can take a few minutes or a few hours depending on how your theme was coded and your HTML expertise.

Eric Davis

Get more organic search traffic for your Shopify store

JSON-LD for SEO icon

Never worry about SEO markup or rich snippets again! One click allows search engines and others to understand your store and products.

Install JSON-LD for SEO