I have couple of products that can only be bought if min quantity is over certain number.
I wrote and put a snippet of code in my child themes functions.php to change the min quantity for products.
function wpa116693_filter_min_quantity( $min, $product ){
if ( has_term ( '5', 'product_tag' ) ){
return 5;
}
if ( has_term ( '10', 'product_tag' ) ){
return 10;
}
if ( has_term ( '6', 'product_tag' ) ){
return 6;
}
}
add_filter( 'woocommerce_quantity_input_min', 'wpa116693_filter_min_quantity', 10, 2 );
So what it does is, if it finds a product with the tag 5 then it will change the quantity min to 5. this works in single product page but it doesn't work in cart page. I can go lower than the min quantity in the cart page. I believe it doesn't work because "has_term" does not work in the cart page.
I want it to work in cart page too. Please help me solve this, thank you.