hide Product in stock: Not available

#79097
  • Resolved Markus
    Rank Math free

    Hello Rank Math Team,
    is it possible to hide/remove the product schema value
    “Product in stock: Not available” with is shown on my website / frontend?
    I am only offering Services so there is no need show any stock
    information. Until version 1.0.44 everything was fine.

    Thx in advance
    Markus

Viewing 5 replies - 1 through 5 (of 5 total)
  • Alberto
    Rank Math business

    Hello,

    Thank you for contacting Rank Math today.

    Hiding (or removing) 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.

    Markus
    Rank Math free

    Hello Alberto,
    thx for your quick reply but this doesn´t help. I need to hide this
    Words completely: “Product in stock: Available”
    I am sure there is filter to hide this, no matter if it cause a warning
    or not. Else, i have to use the version 1.0.431 again, which works fine..

    I hope u ´ll find a solution
    Thx in advance
    Markus

    Hello,

    You can remove it by adding the following filter to your functions.php

    
    /**
     * 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;
    });
    

    Looking forward to helping you. Thank you.

    ​​​​​​

    Markus
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Alberto
    Rank Math business

    Hello,

    If you want we can try logging and taking a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping 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 5 replies - 1 through 5 (of 5 total)

The ticket ‘hide Product in stock: Not available’ is closed to new replies.