top of page

Set minimum Quantity for Woo Commerce Product

  • Writer: سُلَيْمَان بْن دَاوُوْد
    سُلَيْمَان بْن دَاوُوْد
  • Aug 28, 2020
  • 1 min read

We can set minimum quantity as by default for woo commerce product using following code


We have used the Plugin Min Max Quantity plugin from WP Repository and that plugin saves the Min Quantity in post meta min_quantity


add_filter( 'woocommerce_quantity_input_args', 'comcast_woocommerce_quantity_changes', 10, 2 );
   
function comcast_woocommerce_quantity_changes( $args, $product ) {

	
	$id = $product->get_id();
   
   if ( ! is_cart() ) {
  
      $args['input_value'] = get_post_meta($id,'min_quantity',true); // Start from this value (default = 1) 
  
   }
   return $args;
   
}


Recent Posts

See All

Comments


© 2020 by syednazrulhassan

bottom of page