How to Remove JSON/LD Data from Your WooCommerce Products

With the release of WooCommerce 3.0, the structured data format for products was switched to a format known as JSON/LD. The purpose of this post is to show you how to quickly remove this data from your store but first let’s explain what JSON/LD really is.

JSON/LD stands for JavaScript Object Notation for Linked Data. In normal speaking terms, it’s a way to take a collection of data and structure it in such a way that it is usable in other places. In terms of WooCommerce, structured product data is served using JSON/LD throughout the templates on your site. This means any time your products are accessed the details about them can be quickly read by a machine without having to do any complicated parsing.

There are a handful of reasons you might want to disable the way WooCommerce handles JSON/LD data. They vary from not wanting to easily expose the information all the way to wanting to handle how that information is output yourself.

The trick is that WooCommerce serves this data on the front end of your site as well as inside each of the emails that go out to your customers. You can remove JSON/LD data from those two delivery methods with some code or with our plugin.

How to Disable WooCommerce JSON/LD Data with Code

Find the directly on your server where your WordPress theme is installed and download the functions.php file to your computer. Open that file up in a text editor, scroll down to the bottom, and then add the following lines of code depending on what you are trying to accomplish.

To remove JSON/LD data from the frontend of your site add this code:

add_action( 'init', 'my_remove_json_ld_frontend' );
function my_remove_json_ld_frontend() {
    remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 );
}

To remove JSON/LD data from the emails your WooCommerce site sends out add this code:

add_action( 'init', 'my_remove_json_ld_email' );
function my_remove_json_ld_email() {
    remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 );
}

Once you have added the code above, save the functions.php file and upload it back into your theme’s directory. Make sure you have added the code exactly as above as any mistakes might break your store.

It’s important to remember that unless you are using a child theme any changes you make to the functions.php file will be overwritten the next time you download and install an update for the theme you are using.

If you are uncomfortable with this process, or are nervous about attempting it yourself, consider hirign a WordPress developer to do this for you or consider our Remove WooCommerce Features plugin.

How to Remove WooCommerce JSON/LD Structured Data the Easy Way

You can remove JSON/LD data from your site without having to write any code, maintain changes across theme updates or keep a WordPress developer on stand by to do it all for you. Our Remove WooCommerce Features plugin gives you the option to handle this with a few clicks of your mouse. Once you’ve purchased and installed our plugin:

Step #1

Go to the WooCommerce section of your WordPress installation’s admin menu and click the link that says “Remove Features.”

WooCommerce Admin Menu

Step #2

Find the setting for “JSON/LD Structured Data” and click the checkboxes that match which ways you want to disable this feature like so:

Remove WooCommerce Features - JSON/LD Structured Data

Step #3

Press the “Save Settings” button.

Save Settings Button

Our plugin works immediately so as soon as you’ve saved your settings the JSON/LD data will no longer be served by WooCommerce. Remove WooCommerce Features applies your settings no matter what theme you are using so you can rest easy knowing that what you want removed from your store will never reappear in the future.

Remove WooCommerce Features comes out of the box with supoprt for disabling 15+ different parts of your site without you having to write any code at all.

The entire list of (growing) features our plugin supports can be viewed on this site if you’re interested in learning more.