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

Contents

4.2
(6)

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/

Click on a star to rate it!

Average rating 4.2 / 5. Vote count: 6

No votes so far! Be the first to rate this post.


Leave a Reply

Your email address will not be published. Required fields are marked *