image

Shopify default cart quantity to 1 (or a specific number): The complete, merchant-friendly guide

A young woman sitting at a desk, working on a laptop, wearing an orange sweater, with large windows in the background allowing natural light to enter.

If you want every product added to cart to start at quantity 1 — or to a specific number you choose — this guide walks you through everything: the why, the how (Liquid + JavaScript examples you can copy/paste), per-product options (metafields or tags), Ajax/cart drawer caveats, testing checklist, SEO meta suggestions, and exactly what to do if you want us to set it up for you.

Why set your Shopify default cart quantity to 1 (or a specific number)?

  • Better UX — shoppers get a predictable starting point (great for single-item purchases).
  • Reduce accidental bulk orders — if customers land on a product page and the quantity defaults to 1, fewer mistakes.
  • Supports fixed-quantity products (kits, sample packs, subscription add-ons).
  • Works well with upsells — set default to 1, then offer bundle increments separately.

Things to decide before you start

  1. Do you want a global default (all products default to X) or product-specific defaults?
  2. Should the quantity selector be visible (user can change) or hidden / locked to the default?
  3. Do you use Ajax Add-to-Cart / cart drawer or any apps (subscriptions, bundles) that may override cart behavior?
  4. Always work on a duplicate theme and test mobile + desktop + checkout flows.

Make a backup (do this first)

  1. In Shopify Admin > Online Store > Themes, Duplicate your live theme.
  2. Edit the duplicate theme and test there. Never edit the live theme directly.

Quick overview of approaches

  • Liquid-only change — set the <input name="quantity"> value to your default on the product form (works for basic themes).
  • Liquid + JS — ensures JavaScript-based add-to-cart flows respect the default (recommended for modern themes / Ajax).
  • Product-level defaults — use product metafields or product tags to set different defaults per product.
  • Hidden input — hide the visible quantity control and submit a hidden quantity value (useful when you want to lock quantity).
  • Intercept Ajax — for themes that add via JS (fetch/XHR), ensure the JS sends the default quantity.

Simple Liquid change (set default on product form)

Find your product form snippet (often sections/product.liquid, snippets/product-form.liquid, or templates/product.liquid) and locate the quantity input. Replace or ensure the value uses your default.

Example (global default via a section setting):

{%- assign default_qty = section.settings.default_quantity | default: 1 -%}

<label for="Quantity-{{ section.id }}" class="visually-hidden">Quantity</label>
<input
  type="number"
  name="quantity"
  id="Quantity-{{ section.id }}"
  value="{{ default_qty }}"
  min="1"
  aria-label="Quantity">

To add the theme setting (so a merchant can change the default in Theme Editor), add this schema to the bottom of that section file:

{% schema %}
{
  "name": "Product",
  "settings": [
    {
      "type": "number",
      "id": "default_quantity",
      "label": "Default product quantity",
      "default": 1,
      "min": 1
    }
  ]
}
{% endschema %}

Result: product pages will now pre-fill the quantity input with your chosen default.

Want us to set this up for you?

Ensure Ajax add-to-cart respects the default (JS)

Many modern themes use JavaScript to build the add-to-cart request. Add this short script (inserted where your product form appears or in a common script include). This reads the Liquid-provided default and enforces it.

<script>
  // pass default from Liquid into JS
  window.themeDefaultQuantity = {{ section.settings.default_quantity | default: 1 }};

  document.addEventListener('DOMContentLoaded', function () {
    var qtyInputs = document.querySelectorAll('input[name="quantity"]');
    qtyInputs.forEach(function (input) {
      // set default only when empty or zero
      if(!input.value || parseInt(input.value) === 0) {
        input.value = window.themeDefaultQuantity;
      }
    });

    // If your theme uses a custom "add to cart" button handler, intercept and ensure
    // it sends the correct quantity. Example for forms that use FormData:
    document.querySelectorAll('form[action^="/cart/add"]').forEach(function(form) {
      form.addEventListener('submit', function(event) {
        var qtyInput = form.querySelector('input[name="quantity"]');
        if (!qtyInput) {
          // if there's no visible input, append a hidden one
          var hidden = document.createElement('input');
          hidden.type = 'hidden';
          hidden.name = 'quantity';
          hidden.value = window.themeDefaultQuantity;
          form.appendChild(hidden);
        } else {
          if(!qtyInput.value || parseInt(qtyInput.value) === 0) {
            qtyInput.value = window.themeDefaultQuantity;
          }
        }
      });
    });
  });
</script>

Per-product default quantity (metafields or tags)

Metafields (recommended)
Create a product metafield (namespace custom, key default_quantity, type number) in Shopify Admin for products that need a custom default.

Liquid example that uses product metafield first, then section default, then 1:

{%- assign default_qty = product.metafields.custom.default_quantity | default: section.settings.default_quantity | default: 1 -%}
<input type="number" name="quantity" value="{{ default_qty }}" min="1">

Tags (quick and dirty)
Add a product tag like default-qty-3. Parse tag in Liquid:

{% assign default_qty = 1 %}
{% for tag in product.tags %}
  {% if tag contains 'default-qty-' %}
    {% assign default_qty = tag | remove: 'default-qty-' | plus: 0 %}
  {% endif %}
{% endfor %}
<input type="number" name="quantity" value="{{ default_qty }}" min="1">

Lock the quantity (hide selector + submit hidden input)

If you want customers to not change quantity (e.g., fixed kits):

{%- assign default_qty = product.metafields.custom.default_quantity | default: 1 -%}
<!-- Do not show visible quantity input — important: keep accessible label -->
<label class="visually-hidden" for="Quantity-{{ section.id }}">Quantity</label>
<input type="hidden" name="quantity" id="Quantity-{{ section.id }}" value="{{ default_qty }}">

Accessibility note: keep a hidden label so screen readers understand the form.

Enforce increments (step), min, and validation

To force increments (for example, only sell in packs of 3), you can set step="3", but also validate manually with JS (because step alone doesn’t prevent manual input):

<input type="number" name="quantity" id="Quantity" value="{{ default_qty }}" min="{{ default_qty }}" step="3">

<script>
function enforceStepAndMin(input, step, min) {
  var val = parseInt(input.value) || 0;
  if (val < min) val = min;
  var remainder = val % step;
  if (remainder !== 0) {
    val = Math.round(val / step) * step;
    if (val < min) val = min;
  }
  input.value = val;
}

document.querySelectorAll('input[name="quantity"]').forEach(function(input) {
  input.addEventListener('change', function() {
    enforceStepAndMin(input, 3, {{ default_qty }});
  });
});
</script>

Testing checklist (do this on Duplicate theme)

  • Add product to cart from product page — quantity should be your default.
  • Add product to cart using a quick add (if your theme has one).
  • Add product to cart via mobile menu / cart drawer.
  • Use direct cart link with quantity param.
  • Test variants (make sure variant selection doesn’t reset quantity unexpectedly).
  • Test checkout — confirm quantity arrives correctly.
  • Test with any subscription/bundle apps enabled.
  • Test accessibility: can keyboard/screen reader users handle the form?

Troubleshooting (common problems)

  • Theme JS resets the input: look for scripts that set input.value = 1 or rebuild the form — update them to use your default variable.
  • App overwrites quantity: check app docs or contact app devs. Some apps use their own add-to-cart flows.
  • Variant change resets quantity: capture variant change events and reassign the default quantity after variant update.

When to hire an expert

If your theme is heavily customized, you have a cart drawer/Ajax flow, multiple apps (subscriptions, bundles), or you want product-specific rules at scale (e.g., set defaults for 500 products via metafields), getting help saves time and avoids checkout bugs.

We’ll back up your theme, implement the changes (global or product-level), adjust Ajax flows, test mobile/checkout, and leave a clean, editable setting in the Theme Editor. Reply to this message or book a quick setup and we’ll get it done.

(You can also paste your theme name and tell us whether you use a cart drawer and any subscription/bundle apps — we’ll scope it immediately.)

Quick FAQ

Q: Will this affect existing carts?
A: No — it only affects future add-to-cart actions. Existing line items retain their quantities.

Q: Can I set default to a number other than 1?
A: Yes — every snippet above supports any integer. Use theme setting, metafield, or tag to specify the number.

Q: Will this break Shopify Pay or Checkout?
A: No — but always test the full checkout flow after implementation.

Final notes & CTA

If you want help implementing a reliable, test-covered solution to set Shopify default cart quantity to 1 (or a specific number) — from a simple Liquid change to a robust Ajax-compatible implementation plus per-product defaults — send us a quick message and we’ll take care of it. We can also audit your theme to find where to safely add the change and avoid conflicts with apps.

Leave a Reply

Spam-free subscription, we guarantee. This is just a friendly ping when new content is out.

← Back

Thank you for your response. ✨

Optimized Exit-Intent Modal

Discover more from

Subscribe now to keep reading and get access to the full archive.

Continue reading