DopeThemes

Remove WooCommerce Generated Product Schema

Remove WooCommerce Generated Product Schema

WooCommerce, a robust e-commerce platform, equips online entrepreneurs with a myriad of features to enhance their stores. Among these features is the automatic generation of structured data for products, which assists search engines in understanding your website more effectively. However, some store owners might not require this automatically generated product schema markup on their sites. If you’d like to remove the product schema markup from WooCommerce’s Shop and Product Category pages, follow these simple yet effective steps, inspired by Chris Lema and Matt Mullenweg’s writing styles.

Step 1: Locate the functions.php File

Begin by navigating to your WordPress Dashboard and selecting Appearance. From the Appearance menu, choose Theme Editor. This will present a list of files on the right-hand side of the screen. Locate and click on the functions.php file to open it.

Step 2: Embed the Custom Code

To eliminate the product schema markup, copy the code snippet provided below and paste it at the end of the functions.php file:

/**
 * Remove the generated product schema markup from the Product Category and Shop pages.
 */
function wc_remove_product_schema_product_archive() {
	// Remove the action that generates product data from the WooCommerce Shop page.
	remove_action( 'woocommerce_shop_loop', array( WC()->structured_data, 'generate_product_data' ), 10, 0 );
}
// Add the 'wc_remove_product_schema_product_archive' function to the 'woocommerce_init' action.
add_action( 'woocommerce_init', 'wc_remove_product_schema_product_archive' );

/**
 * Remove structured data output on all pages.
 */
function wc_remove_output_structured_data() { 
	// Remove structured data output from the footer of all pages.
	remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 ); 
	// Remove structured data output from the email order details section of WooCommerce emails.
	remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 ); 
} 
// Add the 'wc_remove_output_structured_data' function to the 'init' action.
add_action( 'init', 'wc_remove_output_structured_data' );

This code effectively disables the structured data that WooCommerce generates for products on the Shop and Product Category pages. The first function, wc_remove_product_schema_product_archive(), deactivates the action responsible for generating product data on the WooCommerce Shop page. The second function, wc_remove_output_structured_data(), disables the structured data output in the footer of all pages and the email order details section of WooCommerce emails.

Step 3: Preserve Your Changes

After pasting the code into the functions.php file, save your modifications by clicking the Update File button located at the bottom of the screen.

Step 4: Confirm the Changes on Your Website

Finally, visit your website’s Shop and Product Category pages to ensure that the generated product schema markup has been successfully removed.

By following these steps, you can tailor your WooCommerce store to your specific requirements. Removing the automatically generated product schema markup allows you to maintain a sleek and clutter-free website while still delivering a captivating and user-friendly shopping experience. Keep your content original, engaging, and SEO-friendly to optimize your online presence and attract a wider audience to your store.


Stay in the loop with our web development newsletter - no spam, just juicy updates! Join us now. Join our web development newsletter to stay updated on the latest industry news, trends, and tips. No spam, just juicy updates delivered straight to your inbox. Don't miss out - sign up now!


We’ve tried our best to explain everything thoroughly, even though there’s so much information out there. If you found our writing helpful, we’d really appreciate it if you could buy us a coffee as a token of support.

Also, if you’re interested in learning more about WordPress, Javascript, HTML, CSS, and programming in general, you can subscribe to our MailChimp for some extra insights.

Exit mobile version