woocommerce_product_is_in_stock
Returns whether or not the product can be purchased. This returns true for 'instock' and 'onbackorder' stock statuses.
Использование
add_filter( 'woocommerce_product_is_in_stock', 'wp_kama_woocommerce_product_is_in_stock_filter', 10, 2 ); /** * Function for `woocommerce_product_is_in_stock` filter-hook. * * @param $string * @param $that * * @return */ function wp_kama_woocommerce_product_is_in_stock_filter( $string, $that ){ // filter... return $string; }
- $string
- -
- $that
- -
Где вызывается хук
woocommerce_product_is_in_stock
woocommerce/includes/abstracts/abstract-wc-product.php 1710
return apply_filters( 'woocommerce_product_is_in_stock', 'outofstock' !== $this->get_stock_status(), $this );