Home Forums WoodMart support forum How to format in stock quantity display

How to format in stock quantity display

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #174267

    Joie
    Participant

    Hello, does anyone know how to format the in stock quantity ?
    Currently i have 1000000
    how to display it as 1,000,000

    Attachments:
    You must be logged in to view attached files.
    #174294

    Hello,

    You need to enable the stock management in Woocommerce > Settings > Product > Inventory.

    Best Regards

    #174439

    Joie
    Participant

    Yes i already enable The Woocommerce>Setting>Product>Inventory therefore i can see the remaining stock. In the screenshot the instock quantity is displayed as 1000000 (without thousand separator)

    Do you know how to format it such it is written as 1,000,000 (with thousand separator)

    Attachments:
    You must be logged in to view attached files.
    #174503

    Hello,

    Woocommerce does no provide the option and our theme does not either. You will have to find a plugin.

    Best Regards

    #174506

    Joie
    Participant

    Hello, I found it. Using plugin code snippet i add this code to the be run at front end

    // define the woocommerce_format_stock_quantity callback 
    function filter_woocommerce_format_stock_quantity( $stock_quantity, $product ) { 
        // make filter magic happen here... 
        return number_format($stock_quantity,0,".",","); 
    }; 
             
    // add the filter 
    add_filter( 'woocommerce_format_stock_quantity', 'filter_woocommerce_format_stock_quantity', 10, 2 ); 
    #174552

    Hello,

    That is fine. If you have any questions please feel free to contact us.

    Best Regards

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘How to format in stock quantity display’ is closed to new replies.