It is possible you may see Two products in structured data. This is a result of your Theme templates over-riding the default WooCommerce template. The goal of this plugin is to improve the structured data for your site without changing your site’s appearance. WooCommerce allows Themes to override templates to appear consistent with its look and feel. As a plugin author, we can rely on knowing WooCommerce’s templates but not every theme. Therefore, this plugin’s template overrides the WooCommerce templates but in turn, is overridden by theme templates.
How can you know if this applies to you?
If Schema App WooCommerce is installed and active, then a product page tested on Google Structured Data Testing Tool will show 2 products.
You can also check by going to WP Admin –> WooCommerce –> System Status page. Check if “content-single-product.php” appears in the Template section. If it is there, then your theme overrides WooCommerce’s template. To preserve the look and feel of your website Schema App WooCommerce does not override these.
What is the impact?
It’s worth mentioning that you having two products in your structured data testing tool may not cause any issues. Google has said that when they see two similar data items on the same page, they take the one with more details. In this case, the Schema App WooCommerce will be taken. In this situation, Google may simply disregard the data from your theme’s microdata. We’ve not yet seen negative consequences from this issue. However, if you want the best markup, and it’s likely you do if you’ve bought the plugin, then keep reading.
How can we fix this?
There are three ways to fix it, either to use the remove microdata option from Schema App core plugin, edit your template files to remove microdata or default back to the WooCommerce theme files.
1) Remove Microdata option
The first, easiest method is to use the “Remove Microdata” feature of Schema App core plugin. This can be found under WP Admin –> Settings –> Schema App –> Settings tab, select on the checkbox “Remove Microdata”. This feature will filter the WordPress HTML output to remove all microdata schema markup. We use this option to override the Impreza theme microdata schema markup.
Otherwise, the next best options involve the following development of 4 template files in your theme’s folder structure:
2) Change the theme templates
To markup WooCommerce pages correctly this plugin uses four template overrides. You will want to remove any HTML with itemprop, itemscope and itemtype from the 4 template files listed above. Ideally, you want to do this in a child theme so that your changes are not replaced when you update your theme.
See WordPress Documentation for How to Create a child theme.
Look for four files from your parent theme into the child theme, follow the same folder pattern. The following is an example.
- /wp-content/YOURTHEME/woocommerce/content-single-product.php to /wp-content/CHILDTHEME/woocommerce/content-single-product.php
- /wp-content/YOURTHEME/woocommerce/single-product/price.php to /wp-content/CHILDTHEME/woocommerce/single-product/price.php
- /wp-content/YOURTHEME/woocommerce/single-product/rating.php to /wp-content/CHILDTHEME/woocommerce/single-product/rating.php
- /wp-content/YOURTHEME/woocommerce/single-product/review.php to /wp-content/CHILDTHEME/woocommerce/single-product/review.php
Then in each file, search and remove attributes including itemscope, itemprop and itemtype. Examples that follow have the microdata in bold removed.
<div itemscope itemtype=”<?php echo woocommerce_get_product_schema(); ?>” id=”product-<?php the_ID(); ?>” <?php post_class(); ?>>
… becomes …
<div id=”product-<?php the_ID(); ?>” <?php post_class(); ?>>
<div itemprop=”offers” itemscope itemtype=”http://schema.org/Offer” class=”summary”>
.. becomes …
<h1 itemprop=”name” class=”product_title entry-title”>Silla de ducha y WC Clean</h1>
… becomes …
<h1 class=”product_title entry-title”>Silla de ducha y WC Clean</h1>
When you’re done, activate the child theme and retest the schema markup.
3) Remove the theme templates
An easy way to do this would be to rename your theme’s template files mentioned above. This would restore this plugin’s templates, which are exactly the same as WooCommerce’s templates minus the structured data.