Menu Close

Get Support From ShopWired Close

All Systems Are Operational

Subscribe To Updates
Prefer To Live Chat? Chat directly with ShopWired support Available 9.00am to 7.00pm Monday to Friday
11.00am to 5.00pm Saturday
Quickest response time

Send A Message
Response within 24 hours

Menu Close

Menu

Min/max order quantities

The min/max order quantity extension allows you to set a minimum or maximum order level/quantity for your products. It's effect is that the customer will not be able to add less than the minimum, or more than the maximum, of a product to their basket.

Once the extension is activated, you can follow the instructions below in the 'ShopWired account functionality' section in order to set your required levels.

ShopWired account functionality
Installation instructions (for all theme versions)


ShopWired account functionality

When adding/editing a product, scroll to the 'additional information' section and you'll see two fields, a minimum quantity field and a maximum quantity field.

In the example above, we've set the minimum order quantity to be 3 and the maximum to be 10.

You do not have to set both a minimum and maximum, you can set just one of these fields.


Setting a value for all products

Rather than setting a value individually for each product, you can set a global value if you wish to that applies to all products.

Select 'settings' from the left menu and then 'products' and enter the desired quantities (again you can set only one value if you wish to).

Please Note!

Any minimum or maximum order quantity you set globally (on the product settings page) will override the quantity set per-product.


Customer restrictions

You can set which types of customers are restricted by minimum and maximum order quantities if you only want certain types of customers to be affected by them. By default, all customers will be affected.

Select 'settings' from the left menu and then 'products'.

Using the section shown highlighted in red below, select the customers that should be affected by minimum and maximum order quantities.


Installation instructions (for all theme versions)

Select 'apps and extensions' from the left menu and then 'available extensions'. Find the 'minimum order quantity' extension and click to activate it on your account.

Once the extension is activated you'll then need to add the relevant code to your website's files (described below). To add the relevant code you'll need to use the page editor, alternatively you can click the 'request installation' button and we'll install the code for you (a small charge will be made for the installation, which is listed on the extension page).

These instructions relate to displaying the minimum order quantity set for a product on the product page on your website.

To do so you can use 4 Twig variables:

{{ product.minimum_order_quantity }} will output the minimum order quantity set at a per-product level

{{ global.minimum_product_quantity }} will output the minimum order quantity set globally for all products

{{ product.maximum_order_quantity }} will output the maximum order quantity set at a per-product level

{{ global.maximum_product_quantity }} will output the maximum order quantity set globally for all products

This code should be used on the product.twig file (located in /views/product pages/product.twig) on Version 2 or earlier themes, and on the product_form.twig file (located in /views/partials/) on Version 3 or later themes.

You may choose to write some simple text as shown in the example below to explain the variable as shown in the example below.

This product has a minimum order quantity of <strong>{{ product.minimum_order_quantity }}</strong>.

On the basket page

The product.minimum_order_quantity and product.maximum_order_quantity variables are also available on the checkout/basket page through the basket item object, i.e. item.product.minimum_order_quantity and item.product.maximum_order_quantity.


Javascript implementation

The extension prevents the customer adding less than the minimum order quantity at the platform level, which means that it is only once the product add to basket form is submitted and the page reloads that the user will be informed that they have not added sufficient quantity of the product.

A Javascript implementation is also possible which will work at the browser level (i.e. immediately alerting the user rather than waiting for the form to be submitted and the page to be reloaded).

For example attaching the minimum order quantity to the product add to basket form on the product page, e.g.

<form ... id="product-form" data-min-quantity="{{ global.minimum_product_quantity > 0 ? global.minimum_product_quantity : product.minimum_order_quantity }}">
    ...
</form>

Means you can then reference the minimum order quantity in your Javascript files, e.g.

var form = $('#product-form');
form.on('submit', function(event) {
    var quantity = parseInt(form.data('min-quantity'), 10);
    if(quantity > 0) {
        event.preventDefault();
        ...
    }
});