You can do this with Custom Data by adding a field to all your products called Max Cart Quantity, then edit your Liquid templates in the right place to set the max=“” field on the Quantity <input HTML tag.
Steps:
- Go to Settings → Custom Data → Products
- Click Add Definition
- Add a new field called Max Cart Quantity
- Take note of the Namespace and Key field. This will be important for the Theme editing.
- Select Type as Integer. Set Minimum Value to 1 so that you can’t enter an negative quantity.
- Click Save
It should look like this once saved:
Note the custom field key of product.metafields.custom.max_cart_quantity.
Now lets edit your theme:
- Go to your theme and click on the three dots and click Edit Code.
- Find the .liquid files which contains the Quantity Input field. For the Dawn Theme this is in main-product.liquid and main-cart-items.liquid
- Look for the HTML which contains the quantity. This may looks something like
Edit it to add a max field with a condition like:
{%- if product.selected_or_first_available_variant.product.metafields.custom.max_cart_quantity != null %}
max="{{ product.selected_or_first_available_variant.product.metafields.custom.max_cart_quantity }}"
{%- endif %}
Note the custom field key of product.metafields.custom.max_cart_quantity that was configured in our Custom Data for Products.
Now you can go edit any of your products and edit the Max Cart Quantity custom field that you made.

