This topic has 4 replies, 2 voices, and was last updated 3 months, 1 weeks ago ago by Luca Rossi
hey how are u
how to limit the quantity to the number of stock available ? its give to add more then have in stock pic: https://prnt.sc/YZTytgOXIN32
Hi @Tal,
Please try adding the following code under functions.php file locates in your child theme:
add_filter('woocommerce_quantity_input_max', 'n2t_woocommerce_quantity_input_max', 99, 2);
function n2t_woocommerce_quantity_input_max($max, $product){
return $product->managing_stock() ? $product->get_stock_quantity() : $max;
}
Hope it helps!
Best Regards,
8Theme’s Team
its work but its ruined my design of quantity how to fix it?
before:
https://prnt.sc/YZTytgOXIN32
after:
https://prnt.sc/9xI9iLYwONJl
Hi @Tal,
Please also add this custom CSS codes under XStore > Theme Options > Theme Custom CSS > Global CSS:
.etheme-product-grid-item .quantity-wrapper[data-type=advanced] .quantity .qty {
min-width: 100px;
}
Hope it helps!
You must be logged in to reply to this topic.Log in/Sign up