Black Friday Discount 50% Off · Use Code BF2020 at Checkout

How to Remove WooCommerce JSON/LD Data

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 WooCommerce JSON/LD data from your store but first let’s explain what it actually 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 when your products have been viewed their details 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. We’ll walk you through all that entails in the rest of this article.

How to Hide WooCommerce JSON/LD Data with Code

The actual code you need to add to your site’s theme to remove JSON/LD data is pretty small. The trick is that the safest way to edit a WordPress theme takes a bit of work.

Warning! We’re about to go down a slightly technical road to reach our goal. Please make a full and complete backup of your WordPress installation before getting started. You’ll need a clean backup to restore from if you make a mistake and damage your site.

Make a Child Theme

WordPress themes are not something you should directly edit. The problem when you add, or remove, code from a WordPress theme is that all of your changes can be overwritten. The next time your theme receives an update all of your code will be lost.

Thankfully, the creators of WordPress have a solution for that. They recommend you create something called a child theme. In short, a child theme uses another theme’s files (we call that theme the parent) and then loads its own files second. With this system you can modify code as much as you want and know your child theme’s changes will never be lost.

There is a really great tutorial on Smashing Magazine’s sites about how to create a WordPress child theme. We recommend you start there and then come back when you are ready to proceed.

Add Code to Your Child Theme

Now that your child theme is built it is time to add some code. Every WordPress theme has a file called functions.php. This is the most common place to put basic code changes in a theme. Create the file in your child theme directory if it doesn’t already exist and then open it up in any basic text editor. Add the following lines of code and save the file when you are done.

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 );
}

With your code to remove WooCommerce JSON/LD data in place it is now ready to be uploaded to your server.

Upload Your Child Theme

There are two ways to get your child theme on to your site’s web server. The easiest is to compress the child theme folder into a .zip file. Then you log in to your WordPress admin and head to the Themes area. You can find it in the Appearance menu on the left hand side. From there you can just follow the steps to add a new theme to your site.

Someone with more technical knowledge might prefer to use FTP to upload the child theme to the server. There are plenty of free FTP programs you can install on your computer. Your hosting provider should have documentation, or a support staff, that can walk you through the log in process if you need help.

Zip file? FTP? Is this too technical for you? This process isn’t for everyone. If you would prefer to note deal with code and files we have another solution. Learn how our Remove WooCommerce Features plugin can help you save time.

Activate Your Child Theme

We’ve reached the final step. It’s now time to activate, or turn on, your child theme. Go back to the Themes section of the WordPress admin. You should see your child theme amongst the list of other themes installed on your site. If you don’t see it then there was an issue with the upload. Go back and try again until it shows up.

Press the button to activate your child theme when you’re ready. Your code should activate immediately and remove the WooCommerce JSON/LD data from your site. If it did not, or your site is experience errors, deactivate the theme and go back to review your code. When you find the problem and have it fixed you’ll need to upload and activate the child theme again.

So now you’ve done it. You have built a child theme, written some PHP code, and modified your WooCommerce store. Of course, you could have saved yourself a lot of time and hassle by using our plugin instead.

How to Disable WooCommerce JSON/LD Data the Easy Way

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 the process is simple.

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 checkbox so that it’s marked like so:

Remove WooCommerce Features - JSON/LD Structured Data

Step #3

Press the 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 to be removed from your store will never reappear in the future.

The plugin comes out of the box with support for disabling dozens of different parts of your site without you having to write any code at all.

Remove WooCommerce Features Logo