Loading...
Blueprint

A Smarter Minimum Purchase Quantity Feature For Your Bigcommerce Store

Emilian F. Published on 06 May, 2015

As a store owner you might want to set a minimum purchase quantity for a particular product. Bigcommerce allows you to do this from the control panel by editing a product and clicking on the Other Details tab. Here's how it looks like:

Minimum and maximum purchase amount in the control panel.

Just fill in the Minimum Purchase Quantity field and you are good to go. The frontend will display the minimum quantity in the product details:

The minimum purchase quantity is visible in the product details.

This is all good. The problem comes from the quantity box which shows 1 as the initial value:

Problem: default value is 1 but the minimum purchase is 50.

This creates a lot friction in the buying process because a customer will click the "Add to cart" button only to receive a nasty error message:

Why did you let me select a quantity lower than 50 then?

We can improve the checkout experience by changing the initial value of the quantity box from "1" to whatever the minimum quantity is in the control panel.

Instructions

  1. Open the ProductDetails.html panel file using WebDAV or the design mode feature in your control panel.

  2. Add the following script at the bottom of the file (after the last div):

    <script type="text/javascript">
    $(document).ready(function(){
    var $qtyInputs = $(".qtyInput");
    if(productMinQty > 0) {
      $qtyInputs.val(productMinQty);
    }
    });
    </script>
    
    
  3. Save the changes. If you are using WebDAV upload the file to your Bigcommerce server in the template/Panels/ directory making sure to replace the file that is already there.

How It Works

The productMinQty variable is automatically generated by Bigcommerce. The code waits until the document is ready and then checks to see if the minimum purchase quantity is set. If it is then it will update the quantity input field with the value from the productMinQty variable.

Troubleshooting

The code is straightforward so it should not cause any issues. However, it will not work with quantity dropdowns. You must use the regular input field.

Emilian F. Published on 06 May, 2015