Implementing Minimum Product Quantities on Dawn Theme

I am currently running Dawn 9.0.0.

I have implemented a “minimum quantity” requirement for some of my products by setting up a metafield, and adjusting the product template liquid and main cart liquid. Code shown below.

{% assign min_quantity_cep = product.metafields.custom.minimum_quantity %}
                  

However, the customer may still change the product quantity to less than the required minimum by manually keying-in a different amount on their keyboard.

I have implemented the method described above on a different store, using a different theme. While users can still manually change the quantity number using their keyboard, the “Add to Cart” and “Checkout” validations creates a kick-back error prompting the customer to select the minimum required quantity. Perfect.

On the Dawn theme, this kickback does not happen. The customer can manually key-in a quantity less than the required minimum and proceed to cart and checkout.

To provide a clear example: A minimum product quantity of 25 is set in my product metafield. When viewing the product, the default quantity shown is 25 and the “minus” button on the product quantity box is inactive. However, the customer can click within the quantity box and type 10 as their desired quantity, and add to cart.

Please note: Turning off key-in capability for the product quantity box is not a solution for me.

Thank you in advance for assistance!

Hi,

In this case you need use javascript to catch event when user perform enter manually to input box. You can catch the event change of input box, if the number user fill a number greater than or less than the number you require so the prompting box error will show.