Remove invalid structured data from your Shopify theme

By Ilana Davis

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 are 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 is 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.

Some themes have moved away from microdata or only have a few leftover pieces of code. So if you don’t find any, that’s ok. Keep going.

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.

When in doubt, only delete the specific piece of code (e.g. itemtype="price") instead of the whole line.

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 backward 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’ll 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.ilanadavis.com/products/json-ld-for-seo",
  "@type": "Product",
  "brand": {
    "@type": "Brand",
    "name": "Ilana Davis LLC"
   },
  "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.ilanadavis.com/products/json-ld-for-seo",
  "name": "JSON-LD for SEO",
  "productID": "JSON-LD for SEO"
}
</script>

If you are using the legacy version of JSON-LD for SEO you'll need to migrate to our latest version for Shopify where we'll help to remove any code inserted into your theme from the app.

If you’re using another app for your JSON-LD data and their code is in your theme, you may not want to remove it 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 Schema Markup Validator 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.

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.

Linking Llama

Link discontinued products to their best substitute. Keep discontinued products published on your website and continue to benefit from traffic to these pages.