How can I remove the product/inventory count from the shop page on Woocommerce?

17,987

Solution 1

Navigate to WooCommerce > Settings > Product > Inventory. There is a setting "Stock Display Format". Select the "Never Show Stock Amount" from the drop down.

by CSS .stock { display:none; }

Solution 2

The proper way to do it. Copy and paste this code into you functions.php file in your child theme. Code is tested and working.

/* Remove "in stock" text form single products */
 function remove_in_stock_text_form_single_products( $html, $text, $product ) {
    $availability = $product->get_availability();
    if ( isset( $availability['class'] ) && 'in-stock' === $availability['class'] ) {
        return '';
    }
    return $html;
}
add_filter( 'woocommerce_stock_html', 'remove_in_stock_text_form_single_products', 10, 3 );

Solution 3

This is standard woocommerce functionality, it shows “out of stock” products on the shop page, in the woocommerce widgets, everywhere.

Only on the product single is “Out of stock” shown instead of an “Add to cart”.

Go to Woocommerce → Settings and click the Products tab Click the Inventory link at the top Check the Out Of Stock Visibility option to hide out of stock items

Share:
17,987
T.Doe
Author by

T.Doe

Updated on June 05, 2022

Comments

  • T.Doe
    T.Doe almost 2 years

    Do anyone know how I can remove the number of current available stock that is shown on my Woocommerce product page next the the title of the product? I guess this has changed since the recent Woocommerce update because adding the code snippet

    add_filter( 'woocommerce_subcategory_count_html', 'woo_remove_category_products_count' );
    
    function woo_remove_category_products_count() {
    return;
    }
    

    no longer works. Does anyone have a solution to this? All suggestions are very much appreciated and thank you in advance!

  • T.Doe
    T.Doe almost 8 years
    Is there a reason why going to WooCommerce > Settings > Product > Inventory doesn't work for me? Is it due to last weeks update or something?