mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://businessbloomer.com/woocommerce-disable-out-of-stock-variations-variable-product-dropdown/
6 lines
248 B
Text
6 lines
248 B
Text
add_filter( 'woocommerce_variation_is_active', 'wc_grey_out_variations_out_of_stock', 10, 2 );
|
|
|
|
function wc_grey_out_variations_out_of_stock( $is_active, $variation ) {
|
|
if ( ! $variation->is_in_stock() ) return false;
|
|
return $is_active;
|
|
}
|