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.
Usage
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.
Changelog
Since 9.8.0. | Introduced. |
Where the hook is called
woocommerce_product_attributes_filterer_hide_out_of_stock
woocommerce_product_attributes_filterer_hide_out_of_stock
woocommerce/src/Internal/ProductAttributesLookup/Filterer.php 78
$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 225
$hide_out_of_stock = apply_filters( 'woocommerce_product_attributes_filterer_hide_out_of_stock', 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) );