Home / Blog / Schema and Structured Data / How do I add schema markup on Shopify or WordPress?
Answers

How do I add schema markup on Shopify or WordPress?

15 October 2026 · By John Carlsson
On Shopify, themes already include product schema, and you add more by editing theme code under Online Store, then Edit code from the theme menu, or with the structured_data Liquid filter. On WordPress, use a structured data plugin or add JSON-LD through the wp_head hook in a child theme. Always test the result with Google's Rich Results Test.

Check what you already have

Before adding anything, run one of your product or blog pages through the Rich Results Test. Your theme or a plugin may already output some structured data, and you want to know what is there before adding more.

Shopify's own SEO overview says Shopify handles structured data automatically, that its themes include schema markup for products, and that structured data implementation is built into Shopify themes. So on Shopify, the first job is usually checking and extending, not starting from nothing.

Adding schema markup on Shopify

For markup beyond what your theme outputs, you edit the theme code. Shopify's help centre gives these steps:

  1. Duplicate your theme first, so you have a backup you can go back to.
  2. From your Shopify admin, go to Online Store.
  3. Click the horizontal menu icon next to the theme, then select Edit code.
  4. Add your JSON-LD inside a <script type="application/ld+json"> tag in the relevant template or section, then click Save.

Shopify also gives theme developers a Liquid filter called structured_data. It outputs schema.org JSON-LD for a product (as Product, or ProductGroup when the product has variants) or an article (as Article). The filter does not add the script tag itself, so you wrap it, for example <script type="application/ld+json">{{ product | structured_data }}</script>.

Shopify's help centre notes two cautions. It suggests only editing code if a Shopify app or the theme editor cannot make the change, and it warns that if your code changes conflict with a theme update, your code changes are removed in the updated copy. Keep a note of what you added.

Adding schema markup on WordPress

There are two routes on a self-hosted WordPress site.

Using a plugin

Many plugins in the WordPress plugin directory can add structured data. WordPress's documentation explains how to install one: go to Plugins, then Add New (labelled Add New Plugin in recent versions), search, click Install Now, then Activate. It also says plugins in the directory are of varying quality, so check whether the listing says it is compatible with your version of WordPress and look at the Support tab before installing. Keep plugins updated, which WordPress says helps your site's security and performance.

Adding code yourself

WordPress has an action hook called wp_head, which prints scripts or data in the head of the page. You can hook a function to it that outputs your JSON-LD:

function mysite_schema() {
  echo '<script type="application/ld+json">{"@context":"https://schema.org","@type":"Organization","name":"Example Ltd","url":"https://www.example.co.uk"}</script>';
}
add_action( 'wp_head', 'mysite_schema' );

Put code like this in a child theme's functions.php, not the parent theme. WordPress's theme handbook explains that a child theme lets the parent theme be updated without losing your modifications, and that the child's functions.php loads in addition to the parent's.

Test before and after publishing

Our Schema tools can also check the structured data on a Shopify or WordPress page once it is live.

Sources

Frequently asked questions

Does Shopify add schema markup automatically?

Yes, to a point. Shopify's SEO overview says its themes automatically include schema markup for products and that structured data is built into Shopify themes. What is included depends on your theme, so run a product page through Google's Rich Results Test to see what is already there before adding more, and only add what is missing.

Will a WordPress theme update remove my schema code?

It can if you added the code to the parent theme's files. WordPress's theme handbook recommends a child theme, which lets the parent theme be updated without losing your modifications. Put your wp_head function in the child theme's functions.php, or use a plugin instead, and test the page again after any theme or plugin update.

💬 Got a problem?

aiwebpageseo.com is a data-driven SEO and AEO platform providing a free suite of technical website tools.