woocommerce_stock_amount
Formats a stock amount by running it through a filter.
Использование
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.
Где вызывается хук
woocommerce_stock_amount
woocommerce/includes/wc-formatting-functions.php 481
return apply_filters( 'woocommerce_stock_amount', $amount );
Где используется хук в WooCommerce
woocommerce/includes/wc-core-functions.php 42
add_filter( 'woocommerce_stock_amount', 'intval' ); // Stock amounts are integers by default.