Removing “offers” from json+ld not working

#129170
  • I tried removing the “offers” from the rich snippet but it didnt work.

    Here’s the code I tried (I added it using the code snippets plugin) :

    
    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	unset($entity['offers']);
    	return $entity;
    });
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for the delay and for any inconvenience this issue may have caused you.

    The filter you have provided seems to be working fine on our end. Please see the screencast:
    https://i.rankmath.com/4grby9

    Could you please also ensure that the code runs in your theme’s functions.php file?

    I hope that helps. Thank you, and looking forward to your update.

    Thank you for your answer.
    Turns out my problem was that the schema for the products weren’t set on “Woocommerce product”. I’m not really sure of why there were schemas on those pages to begin with, but setting the products to “Woocommerce product type” and using the following code did the trick. (also removed the meta tags)

    add_filter("rank_math/snippet/rich_snippet_product_entity", function($entity) {
    	unset($entity['offers']);
    	return $entity;
    });
    add_filter( "rank_math/opengraph/facebook/product_price_amount", "__return_empty_string");
    add_filter( "rank_math/opengraph/facebook/product_price_currency", "__return_empty_string");
    add_filter( "rank_math/opengraph/facebook/product_availability", "__return_empty_string");
    

    Hello,

    We are super happy that this issue is now resolved. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Removing “offers” from json+ld not working’ is closed to new replies.