Posted on Leave a comment

Fix Invalid value in field “priceSpecification” (in “offers”)

With recent Google changes in rich snippets, you may find your WooCommerce sites hit with this error.

Fix Invalid value in field "priceSpecification" (in "offers") 1

Investigate further, you see this error highlighted:

Invalid value in field "priceSpecification" (in "offers")

For someone who don’t know much about code, this looks like Greek.

However, the fix is quite simple, you need to remove that part.

Remove priceSpecification

Before doing this, make sure you created a child theme or have a plugin available that you can paste custom code to.

If you have a child theme, put the following code in the functions.php of that theme:

function wc_remove_some_structured_data( $markup ) {
unset($markup['offers'][0]['priceSpecification']); // price removed without stock info
return $markup; }
add_filter( 'woocommerce_structured_data_product', 'wc_remove_some_structured_data' );

This need to be in a <?php block. If you are not sure, hire somebody to do that for you. Doing it wrong may break your site:

Pasting code to remove priceSpecification snippet
Pasting code to remove priceSpecification snippet

Save the file and you are done. Time to request Google to validate the fix.

Credit of this fix goes to paddydoran on this post https://wordpress.org/support/topic/invalid-value-in-field-pricespecification-in-offers/