woocommerce_format_stock_quantity
Format the stock quantity ready for display.
Usage
add_filter( 'woocommerce_format_stock_quantity', 'wp_kama_woocommerce_format_stock_quantity_filter', 10, 2 ); /** * Function for `woocommerce_format_stock_quantity` filter-hook. * * @param int $stock_quantity Stock quantity. * @param WC_Product $product Product instance so that we can pass through the filters. * * @return int */ function wp_kama_woocommerce_format_stock_quantity_filter( $stock_quantity, $product ){ // filter... return $stock_quantity; }
- $stock_quantity(int)
- Stock quantity.
- $product(WC_Product)
- Product instance so that we can pass through the filters.
Changelog
Since 3.0.0 | Introduced. |
Where the hook is called
woocommerce_format_stock_quantity
woocommerce/includes/wc-formatting-functions.php 1287
return apply_filters( 'woocommerce_format_stock_quantity', $stock_quantity, $product );