Quantity Input Ignoring Max Inventory Limit on Dawn Theme

Hi everyone,

I’m using the latest version of the Dawn theme on my Shopify store, and I’ve encountered an issue with the quantity selector on the product page.

For one of my products, I have inventory tracking enabled and have set the available quantity to 1. I also made sure that “Continue selling when out of stock” is turned off.

Despite that, on the storefront, customers can still manually increase the quantity beyond 1 using the plus button on the quantity selector. The input field appears to have the correct maximum limit set, and when hovering over the plus button, the browser shows a red warning — but the button still works and increases the quantity anyway.

I’m not using any custom apps or scripts for this — it’s just the default Dawn setup.

Has anyone experienced this before? Where should I adjust the JavaScript to ensure the quantity cannot exceed the available inventory?

I’d really appreciate any help or direction. Thanks a lot!

1 Like

Hi,

Hope this will help

  • Look for the quantity “plus” button logic
  • Add a check for max quantity
    Just before it increases number, add a simple check to stop it if we’ve already reached the limit.

Replace this:

quantityInput.value = currentQuantity + 1;

With this: code example

const max = parseInt(quantityInput.getAttribute('max'));
if (currentQuantity < max) {
quantityInput.value = currentQuantity + 1;
}

thanks so much for your reply
is it possible to tell me in which file i have to make the edit?
thanks.