woocommerce_product_attributes_filterer_hide_out_of_stock
Filters the woocommerce_hide_out_of_stock_items option to override the default behavior in product filtering by attribute.
Использование
add_filter( 'woocommerce_product_attributes_filterer_hide_out_of_stock', 'wp_kama_woocommerce_product_attributes_filterer_hide_out_of_stock_filter' );
/**
* Function for `woocommerce_product_attributes_filterer_hide_out_of_stock` filter-hook.
*
* @param bool $option_value The behavior configured in WooCommerce settings.
*
* @return bool
*/
function wp_kama_woocommerce_product_attributes_filterer_hide_out_of_stock_filter( $option_value ){
// filter...
return $option_value;
}
- $option_value(true|false)
- The behavior configured in WooCommerce settings.
Список изменений
| С версии 9.8.0. | Введена. |
Где вызывается хук
woocommerce_product_attributes_filterer_hide_out_of_stock
woocommerce_product_attributes_filterer_hide_out_of_stock
woocommerce/src/Internal/ProductAttributesLookup/Filterer.php 88
$hide_out_of_stock = apply_filters( 'woocommerce_product_attributes_filterer_hide_out_of_stock', 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) );
woocommerce/src/Internal/ProductAttributesLookup/Filterer.php 237
$hide_out_of_stock = apply_filters( 'woocommerce_product_attributes_filterer_hide_out_of_stock', 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) );