Override out-of-stock visibility setting on a specific product category in WooCommerce

Override out-of-stock visibility setting on a specific product category in WooCommerce on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_filter( 'pre_option_woocommerce_hide_out_of_stock_items', 'wc_hide_out_of_stock_exception_category' );
 
function wc_hide_out_of_stock_exception_category( $hide ) {
   if ( is_product_category( 'tables' ) ) {
      $hide = 'no';
   }   
   return $hide;
}
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.