Skip to main content
improved code formatting, clarified a bit title.
Link
rudtek
  • 6.3k
  • 5
  • 30
  • 52

Set a default quantity input value for a variable product category in WoCommerceWooCommerce

set Set a default quantity input value for a variable product category to 500in WoCommerce

I have a variable product called flyer in woocommerce, and I want to set its default quantity input value to 500 as its min quantity. This is what I have done so far, but the default quantity is still 1.

add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' ); // Variations
 
function jk_woocommerce_available_variation( $args ) { 

    

 if( has_term('flyer') )
    
       $args['max_qty'] = 10000;        // Maximum value (variations)
       $args['min_qty'] = 500;
       $args['input_value']=500;

    return $args;
}

}

set a default quantity input value for a variable product category to 500

I have a variable product called flyer in woocommerce, and I want to set its default quantity input value to 500 as its min quantity. This is what I have done so far, but the default quantity is still 1.

add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' ); // Variations
 
function jk_woocommerce_available_variation( $args ) {
    

 if(has_term('flyer'))

   $args['max_qty'] = 10000;        // Maximum value (variations)
   $args['min_qty'] = 500;
   $args['input_value']=500;

return $args;

}

Set a default quantity input value for a variable product category in WoCommerce

I have a variable product called flyer in woocommerce, and I want to set its default quantity input value to 500 as its min quantity. This is what I have done so far, but the default quantity is still 1.

add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' ); // Variations
function jk_woocommerce_available_variation( $args ) { 

    if( has_term('flyer') )
    
       $args['max_qty'] = 10000;        // Maximum value (variations)
       $args['min_qty'] = 500;
       $args['input_value']=500;

    return $args;
}
Source Link

set a default quantity input value for a variable product category to 500

I have a variable product called flyer in woocommerce, and I want to set its default quantity input value to 500 as its min quantity. This is what I have done so far, but the default quantity is still 1.

add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' ); // Variations

function jk_woocommerce_available_variation( $args ) {
    

if(has_term('flyer'))

   $args['max_qty'] = 10000;        // Maximum value (variations)
   $args['min_qty'] = 500;
   $args['input_value']=500;

return $args;

}