Answers for "hide inactive attribute woocommerce"

0

hide inactive attribute woocommerce

/**

 * Disable out of stock variations

 * @return Boolean

 */

function njengah_variation_is_active( $active, $variation ) {

 if( ! $variation->is_in_stock() ) {

 return false;

 }

 return $active;

}

add_filter( 'woocommerce_variation_is_active', 'njengah_variation_is_active', 10, 2 );
Posted by: Guest on October-12-2021

Browse Popular Code Answers by Language