How to format in stock quantity display
-
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.
Hello,
You need to enable the stock management in Woocommerce > Settings > Product > Inventory.
Best Regards
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.
Hello,
Woocommerce does no provide the option and our theme does not either. You will have to find a plugin.
Best Regards
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 );
Hello,
That is fine. If you have any questions please feel free to contact us.
Best Regards
The topic ‘How to format in stock quantity display’ is closed to new replies.