How can I edit the Dawn theme to limit cart quantity?

Topic summary

Limiting product quantity in Shopify’s Dawn theme. The OP set max=“3” on the quantity inputs in main-product.liquid and main-cart-items.liquid, which stops the + button above 3 but still allows typing a higher number; checkout then blocks proceeding.

Proposed fix: Add CSS to disable typing in the numeric input while keeping button controls:

  • Path: Online Store → Theme → Edit code → Assets → base.css.
  • Code: .quantity__input[type=number] { pointer-events: none; }
    Pointer-events: none prevents mouse interactions with the input field; quantity changes would occur via the +/- controls.

Alternative solution: Use an app (Limit Quantity Purchase) to set min/max limits per product, collections, or product groups.

New/ongoing questions:

  • Cart-wide cap (e.g., total quantity across all products limited to 5) requested; current max=“x” only affects per-item limits. No code solution provided yet.
  • Exact steps for implementing the per-product limit requested by others.
  • One store reports being unable to add more than one product; likely unrelated configuration issue.
  • Preventing typing when clicking the “Quantity” label remains partially addressed; may need additional changes beyond the CSS.

Status: CSS-based input disabling suggested; broader cart-wide limits and implementation details remain unresolved.

Summarized with AI on January 11. AI used: gpt-5.

Hello. I am trying to limit the quantities people can add to cart. I was able to add a line of code to

main-product.liquid under the section and { min=“0” } line

main-cart-items.liquid under the section and { min=“0” } line

saying { max=“3” } and now people cannot use the + button to add more than 3 to cart. But they can still type a number larger than 3, and add it to cart that way.

Is there a way to edit this part as well?

1 Like

@ShawnBHS

Sorry you are facing this issue, it would be my pleasure to help you.

Welcome to the Shopify community! :blush:
Thanks for your good question.

Please share your site URL,
I will check out the issue and provide you a solution here.

1 Like

thebesthomesupply.com

1 Like

@ShawnBHS

great thanks

i have check cart its work i have add only 3

1 Like

But if you click on the Quantity box you can type a number that is larger than 3, and it will accept it

1 Like

Ah I see, it won’t let you actually proceed to checkout. I did not actually test going to checkout, just adding to cart.

I wonder if this is something Google would recognize when doing their crawls? I read they try to look at your inventory levels based on adding products to cart.

@ShawnBHS

oh i see please add this code

  1. Go to Online Store->Theme->Edit code
  2. Asset->/base.css ->paste below code at the bottom of the file.
.quantity__input[type=number] {pointer-events: none;}
1 Like

Hey @ShawnBHS

For an easy solution, I can suggest a Shopify app called Limit Quantity Purchase.

The features of this app are as below:

  1. Specific Product purchase limits Minimum and Maximum.

  2. Flexible Purchase Limit of items within a group of products.

  3. Apply Limit For individual products or collection

It has all the features that you have mentioned in your query. Please, check it out here for more details: Shopify Limit Qty Purchase

Hope this helps you.

Thank you.

I cannot add more than one product to my cart, please help junglearth.in

@ShawnBHS

Hi,

I want to implement the code to limit the total order quantity to 5. Can you please guide me step-wise how to do it?

What is the code that should be copy-pasted? And where exactly should it be pasted?

I am using Dawn 10.0 theme.

Regards,

Ahsan

Setting max=“5” in the codes (where you’ve mentioned) just restricts the product quantity. I have multiple products but I want that customers shouldn’t be able to checkout with more than 5 items; either 1 product added 5 times or multiple products added so that total quantity of these products does not exceed 5.

E.g. Three products added so that total item count is 5.

Product A: 2

Product B: 1

Product C: 2

The system shouldn’t let them add more than 5 items. Please support.

@KetanKumar

@ShawnBHS

Hi there,

I can’t seem to figure out how to do this. I see that you are asking a different question but maybe you can help me with the original question as I see that you figured it out. Can you tell me exactly where and which codes you changed to restrict the product quantity limit? Anything I’m trying isn’t working.

Thank you so much.

I have applied this code and it does work. But now when you click on the text ‘Quantity’, you can type a number. How do we limit that so the customer can only increase the quantity through the ‘+’ sign?