/* drop this in your themes functions.php file */
add_filter( 'woocommerce_structured_data_product_offer', 'my_woocommerce_structured_data_product_offer', 10, 2 );
function my_woocommerce_structured_data_product_offer( $markup, $product ) {
/* new condition */
if ( empty( $markup[ 'itemCondition' ] ) ) {
$markup[ 'itemCondition' ] = 'http://schema.org/NewCondition';
}
return $markup;
}
/* other conditions available
http://schema.org/DamagedCondition
http://schema.org/NewCondition
http://schema.org/RefurbishedCondition
http://schema.org/UsedCondition
*/
WooCommerce Missing microdata for condition solution
This snippet will add the itemCondition microdata to all of your WooCommerce products.
This is recommended by Google Merchant Center, which typically throws a warning if it's not present.
Snippet Viewed 3348 times.
Share your WooCommerce code snippets:
- Get some recognition & a link back to your site.
- Create your own code library.
- Help your fellow developers, as they have helped you.