Hide price in product rich snippet

#14706
  • Resolved Gabriel
    Rank Math free

    Hi, Could you please explain how to remove price field from the product rich snippets using functions.php?
    I do not want the price to show on google.

    • This topic was modified 4 years, 6 months ago by Gabriel.
Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today.

    You can use the following code to remove the price from the schema:

    /**
     * Filter to modify Rank Math product schema data
     * Replace $schema_type with schema name like article, review, etc.
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	unset($entity['offers']['price']);
    	
    	return $entity;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Hide price in product rich snippet’ is closed to new replies.