the MMM blog

Remove WooCommerce schema data ld+json

Remove WooCommerce schema data ld+json


WooCommerce 3+ introduced a new feature - structured data in ld+json format. But if you already implemented structured data before in your template, this would cause duplicated schema markup.

To remove it, use the following code in functions.php:

  
function remove_output_structured_data() 
{ 
remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 ); // Frontend pages 
remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 ); // Emails 
} 
add_action( 'init', 'remove_output_structured_data' );

"The secret of getting ahead is getting started"

Contact me!

Have questions? Feel free to use the form or send me an email with any questions.

I will be responsive to your requests and your questions.