Home » WooCommerce: Display Stock Status/Quantity @ Shop Page

WooCommerce: Display Stock Status/Quantity @ Shop Page

by Tutor Aspire

In this tutorial, my goal is to show the “stock quantity or status” under each product in the shop, category and archive pages.

This follows exactly the same settings as the stock display of the single product page. Go to /wp-admin/admin.php?page=wc-settings&tab=products§ion=inventory to manage “Stock display format”. Enjoy!

WooCommerce: Add Stock Quantity on Shop Page

PHP Snippet: Display Stock Quantity/Status @ WooCommerce Shop Page

/**
 * @snippet       Stock Quantity @ WooCommerce Shop / Cat / Archive Pages
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WooCommerce 3.7
 * @donate $9     https://tutoraspire.com
 */

add_action( 'woocommerce_after_shop_loop_item', 'tutoraspire_show_stock_shop', 10 );
 
function tutoraspire_show_stock_shop() {
global $product;
echo wc_get_stock_html( $product );
}

You may also like