Remove the WooCommerce 3.+ JSON/LD Structured Data format

September 1, 2019 0 comments
Remove the WooCommerce 3.+ JSON/LD Structured Data format

 

WooCommerce 3 introduced a new format to structured product data called JSON/LD. Despite the fact that this improvement is a huge step forward, some people asked how to remove it.

From our official post release:

Previously, structured data was output inline in our template files (marking up things such as products). In 3.0 we’ve switched to JSON-LD format which keeps our template files tidy and keeps data intact if customizations are made by theme developers.

But for some reason you might be tempted to remove this method that adds some javascript to your page source code. To do so, use this code:

if ( class_exists( 'WooCommerce' ) ):
function osc_remove_output_structured_data() {
remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 );
}
add_action( 'init', 'osc_remove_output_structured_data' );
endif;

Ashok kuikel

Ashok Kuikel is DevOps Engineer(Cloud Computing and Cyber Security), Entrepreneur working on Socio-Economic Development via Technology

He has been actively contributing as Joint Secretary of Federation of Computer Association of Nepal Kavre Chapter. Beside that, he is an official Global Peace Ambassador for Global Peace Chain, Nepal Chapter and Member of Internet Society, Nepal Chapter.

Above all, he enjoys learning about new trends and technologies and loves to share innovative ideas to contribute for the growth of the industry.

You can follow me on Social Media, GitHub, and via my Blog Channels.

Leave a Reply

Articles and Tutorials

We love writing about WordPress and latest plugins tutorials, WooCommerce stats, and much more.