SEOWooCommerceWordpress

How To Remove WooCommerce JSON/LD Structured Data

By April 11, 2018 2 Comments

WooCommerce 3 introduced a new format to structured product data called JSON/LD.  Overall it’s a big improvement from WooCommerce 2.x.  That said some of us may generate our own Schema Data with other plugins or custom code.  So how do we turn off and disable the WooCommerce function?

Going through the templates and removing really isn’t an ideal solution here.  Luckily there is a single function you can add to your child theme’s functions.php file that will disable this.

/* Remove the default WooCommerce 3 JSON/LD structured data */
function remove_output_structured_data() {
  remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 ); // This removes structured data from all frontend pages
  remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 ); // This removes structured data from all Emails sent by WooCommerce
}
add_action( 'init', 'remove_output_structured_data' );

I’ve added comments above, the first remove action is for frontend pages and the second is for emails.  You can choose to use either one or both.

We have a Structured Data plugin in the works that will be released before the end of April that gives you more control over the Schema Data.  Within this plugin we’ll include the option to disable not only the WooCommerce Schema Data, but also Yoast’s Schema Data.  We’ll drop a link here once it’s approved and released!

2 Comments

  • Kyle says:

    This solution didn’t work for me. It doesn’t appear to turn woocommerce structured data off. I pasted the exact code into my child theme functions.php file. Is there something that I’m doing wrong? Thanks in advance.

    • Prodjex says:

      Just checked it out and appears it’s not turned off as you mentioned and also being duplicated further down the page. Google looks at the first instance only. What version of WooCommerce?

Leave a Reply