Hide Out of Stock

#35169
  • Resolved Darren Nicholls
    Rank Math business

    Hi,

    I was wondering if you could help please? We have an e-commerce website where some of the products aren’t sold directly online. To support the ‘Request a Quote’ option these products are set as ‘out of stock’. The problem we have at the moment is that they are then appearing on Google as ‘Free – out of stock’. Is there any way of hiding this from the Google meta description? I could find the option to do so on Yoast but we’re moving over to Rank Math on all our sites.

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael Davis
    Rank Math pro

    Hello,

    Thank you for contacting Rank Math today.

    Hiding this schema value might cause a warning on your product schema but you can set this to InStock for all your products by using the following code in your theme’s functions.php file:

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

    Looking forward to helping you. Thank you.

    ​​​​​​

    Darren Nicholls
    Rank Math business

    Hi,

    Thanks for this. Just waiting for it to reindex and see the magic! Thanks again.

    Michael Davis
    Rank Math pro

    Hello,

    We are super happy that this resolved your issue. 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 ‘Hide Out of Stock’ is closed to new replies.