How to turn off “availability” under product schema

#302062
  • Resolved xboxsimpson
    Rank Math free

    Hello,

    I have a question regarding the “availability” portion of the product schema. Is the “availability” always shown? I would like to show the rating, but not availability, as I see that others have done via google search.
    Is this possible? Thank you.

    Alex

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

    Thank you for contacting Rank Math and bringing your concern to our attention.

    The availability is not required in the Product Schema, but for Google Images, this property is required for your product to be eligible for the Related Items feature in Google Images.

    Here’s a link for information:
    https://developers.google.com/search/docs/advanced/structured-data/product

    However, you can try this filter to remove the availability from the product schema:

    /**
     * Filter to mod product schema.
     *
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
        if ( isset( $entity['offers']['availability'] ) ) { 
    		unset( $entity['offers']['availability']);
        return $entity;
    }});

    I hope that helps.

    Thank you.

    Hello,

    Thank you for your response. So if I leave this part of the Product Schema as shown (the default way), will availability be displayed in searches?
    availability
    If it’s still shown, is there any way to remove it in Rank Math Free?

    Thank you,
    Alex

    Prabhat
    Rank Math agency

    Hello,

    You can add the filter code provided by my colleague to remove the Availability entity from the product schema.

    Yes, after adding the filter, you can leave that field as it is and it will not be rendered on the front end.

    When the entity will not be available, it would be unlikely for Google to add it in the rich results.

    You can follow this guide to add the filter:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope this helps.

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

The ticket ‘How to turn off “availability” under product schema’ is closed to new replies.