I Want To Hide Availability & Price From Search Results

#60984
  • Resolved Ads Freelancer
    Rank Math free

    Hi Team,
    I am selling service as a product and the problem now is google is showing availability as in-stock and price I want to hide them from the rich snippet as I’m selling a virtual product/service, please help me hiding price and availability if hiding price is not recommended please help me hide availability. Please Check The Screenshot: http://prntscr.com/syfysu

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math today.

    You can use the following code to hide the price:

    /**
     * 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.

    How to hide availability sir?

    Hello,

    Please use the following code to remove price and availability:

    
    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	unset($entity['offers']['price']);
    	unset($entity['offers']['availability']);
    
    	return $entity;
    });
    

    Price is a required field in Product schema, so you should not remove it. You might get an error in the Schema for the missing price.

    I hope that helps.

    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 3 replies - 1 through 3 (of 3 total)

The ticket ‘I Want To Hide Availability & Price From Search Results’ is closed to new replies.