[Resolved] I am trying to hide “in stock” from the product front end page

Home Forums Support I am trying to hide “in stock” from the product front end page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1371834
    adriendemonta

    Dear Generatepress Team,

    I need your help. I m trying to hide “in stock” from showing on the product front end page.
    Here an image: https://snipboard.io/u2fDK0.jpg

    I went in the back end following some other support tickets and set this:https://snipboard.io/0mdT3E.jpg

    However “in Stock” still shows. I hope you can help me to hide this.

    Thank you very much in advance. Best, Adrien.

    #1371901
    David
    Staff
    Customer Support

    Hi there,

    try this PHP snippet:

    function my_wc_hide_in_stock_message( $html, $text, $product ) {
    	$availability = $product->get_availability();
    	if ( isset( $availability['class'] ) && 'in-stock' === $availability['class'] ) {
    		return '';
    	}
    	return $html;
    }
    add_filter( 'woocommerce_stock_html', 'my_wc_hide_in_stock_message', 10, 3 );
    #1371962
    adriendemonta

    Thank you very much David. It worked!
    In fact, I had this already but while reading the other posts I thought I didn’t need the Snippet and that there was a back end option to do it.

    #1372032
    David
    Staff
    Customer Support

    I think the individual product stock settings can override that general setting – not sure as Woo does some mysterious things …

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.