woocommerce_stock_amount
Formats a stock amount by running it through a filter.
Usage
add_filter( 'woocommerce_stock_amount', 'wp_kama_woocommerce_stock_amount_filter' ); /** * Function for `woocommerce_stock_amount` filter-hook. * * @param int|float $amount Stock amount. * * @return int|float */ function wp_kama_woocommerce_stock_amount_filter( $amount ){ // filter... return $amount; }
- $amount(int|float)
- Stock amount.
Where the hook is called
woocommerce_stock_amount
woocommerce/includes/wc-formatting-functions.php 481
return apply_filters( 'woocommerce_stock_amount', $amount );
Where the hook is used in WooCommerce
woocommerce/includes/wc-core-functions.php 42
add_filter( 'woocommerce_stock_amount', 'intval' ); // Stock amounts are integers by default.