Support » Plugin: WooCommerce » Google Search Console on product pages – Proposed fix does not work

  • Resolved administratus

    (@administratus)


    Hey there,
    I use WP with WooCommerce and StoreFront (hence, a pretty basic setup). Since a couple of weeks Google has been sending me notifications about search console errors that affect single product-pages. The error reads as follows:

    Either “offers”, “review”, or “aggregateRating” should be specified

    I did my research and found out that the problem first occured earlier this year, affecting many webshops after a Google update.

    There are many threads on many boards concerning the issue (also here: https://wordpress.org/support/topic/either-offers-review-or-aggregaterating-should-be-specified-error/) and there is a proposed fix (https://www.checkerboard.com/web-development/fix-offers-review-aggregaterating-specified/).

    It’s claimed that adding the following code to the functions.php of the theme will fix the error:

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

    Last week a added this code to the functions.php, using the plugin Theme Customisations. Unfortunately, it didn’t fix the errors. Actually, more product pages are affected every day.

    Does anyone here have any idea what the problem may be?

    Here is a screencap from the Search Console:
    https://imgur.com/a/ovprrAR

    Thank you for any suggestions!

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support mother.of.code

    (@imazed)

    The Mother of Code | Automattic Happiness Engineer

    Hi there!

    This is a known issue that has been reported in the GitHub project for WooCommerce: https://github.com/woocommerce/woocommerce/issues/24862. The developers have indicated that a solution is ready to go and will be included in the release after 3.8

    Hope that helps!

    administratus

    (@administratus)

    Hey there! Thank you for your reply, and for the link! I am glad to hear the developers are aware that the error has reoccured and that they are already working on a solution.

    If anyone happens to know if the above mentioned fix is still supposed to work for the time being, please let me know!

    rtddev

    (@rtddev)

    administratus

    (@administratus)

    @rtddev Thank you for the reply!
    I have been able to fix the brands-warning, but not the errors concerning “offers”, “review”, or “aggregateRating.

    Actually, the link that you shared does not offer a fix for that?!

    At the end there is a link to the discussion here, which basically also says we have to wait for the WooCommerce 3.8 Update:
    https://github.com/woocommerce/woocommerce/issues/24862

    Please tell me there is a fix so all the hard work we put into getting the products to rank on google won’t be in vain until WooCommerce gets its head around releasing that update?

    rtddev

    (@rtddev)

    @administratus – sorry about that, there are two threads that cover some of the schema issues.

    Here’s the other one that addresses “offers”, “review”, or “aggregateRating.
    https://wordpress.org/support/topic/either-offers-review-or-aggregaterating-should-be-specified-error-5/

    administratus

    (@administratus)

    Thank you so much for the link to the other thread!
    I tried the solution metioned there – i.e. adding this code to the functions.php:

    function com_temp_fix_structured_data_review( $markup, $comment ) {
    	$product = wc_get_product( $comment->comment_post_ID );
    	$markup['itemReviewed']['aggregateRating'] = array(
    		'@type'       => 'AggregateRating',
    		'ratingValue' => $product->get_average_rating(),
    		'reviewCount' => $product->get_review_count(),
    	);
    	return $markup;
    }
    add_filter( 'woocommerce_structured_data_review', 'com_temp_fix_structured_data_review', 10, 2  );

    I already ran the error-fix-checker in the Search Console but it will take some time until Google crawles all the products pages again. I will update here whether the errors disappear or not 🙂

    rtddev

    (@rtddev)

    @administratus – You can use the Google Structured Data Testing Tool to verify the fix. Just test some of the URLs that were throwing the warning/error.

    administratus

    (@administratus)

    Thanks for the hint 🙂
    I just checked a couple of pages and all the errors seem to be gone! warnings remain, but they don’t stress me out so much. hope WooCommerce can figure out all the schema-stuff with the next update!

    rtddev

    (@rtddev)

    @administratus – Awesome. Glad it worked out!

    administratus

    (@administratus)

    Thanks a million for the help!
    If anyone else enconters the same error, i highly recommend trying the fix above. Just add the code to the functions.php (i used the plugin Theme Customisations for that) and the errors should be gone.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Google Search Console on product pages – Proposed fix does not work’ is closed to new replies.