Make a selection

Can customers buy in increments (eg. buy 5 for $X, buy 10 for $Y, etc.)?

Laurel
Laurel
  • Updated

Yes. With some code adjustments to your theme, this can be accomplished. Please follow the steps below.

Alert

  • The Quantity Breaks (standalone) app is no longer available for new installations. If you are currently using Quantity Breaks, you will be able to continue using the app on a grandfathered plan.
  • New requests for Quantity Breaks will be directed to Custom Pricing. Custom Pricing's Select plans can be used to create quantity breaks. For more information on pricing, please visit Custom Pricing Overview.
  • If you'd like move from Quantity Breaks (standalone) to Custom Pricing, please visit Switch from Quantity Breaks to Custom Pricing.

 


 

Setup

  1. From the Shopify admin, navigate to Sales channels > Online Store > Themes.
  2. Click the ellipsis next to your desired theme and select Edit Code.
  3. Under Templates, open product.liquid.

    Note: If your theme contains sections, you may have to make these changes in a different file, like product-template.liquid under "Sections".

  4. Find the quantity box code that looks like this:
    <label for="Quantity">{{ 'products.product.quantity' | t }}</label>
    <input type="number" id="Quantity" name="quantity" value="1" min="1" class="product-form__input" pattern="[0-9]*">

    Note: Some themes, like Radiance, do not have a quantity box. If yours doesn't, you can skip this step.

    find the quantity box

  5. Replace with this code:
    <label for="quantity">Quantity:</label> 
    <select id="quantity" name="quantity">
    {% for i in (1..10) %}
    <option value="{{ i | times: 1 }}">{{ i | times: 1 }}</option>
    {% endfor %}
    </select>

    replace with this code

  6. Click Save.

This code will create a drop-down list of the numbers 1 through 10. To customize this code:

{% for i in (1..10%} controls the number of selectable options in the drop downs.

<option value="{{ i | times: 1 }}">{{ i | times: 1 }}</option>

Change the 1 to the number of increments in your discount. So if your discounts change in increments of 25, you would change the 1 to 25.