codehaven - php snippets - coding help
Generic filters
Exact matches only
  • Add how many left in stock on products stock controlled only – Woocommerce

    21st January 2021

    WooCommerce

    woocommerce category codehaven

    I have 3 products in woocommerce that I wish to sell and show how many left in stock for each one. The rest of the website is not stock controlled.
    I do not want to show a label that says 745 in stock or whatever for all of them as they are always in stock. Just the clearance or on sale items in my one and only page.
    The code below achieves this.

    Add the code to the functions.php

    With thanks to this site for this great code https://www.businessbloomer.com/woocommerce-add-stock-quantity-on-shop-page/

    Was this code snippet helpful?