2.Installation & Configuration
The Quantity Limits module allows you to set both a minimum and maximum purchase limits on individual products. This allows you to restrict purchases to a maximum per order or set a minimum quantity for an order.
The product limits can be set in 1 of 4 ways:
System Requirements: Miva 9.14 or later.
The Quantity Limits module can be downloaded from the Miva App store here: https://apps.miva.com/quantity-limits.html
Once downloaded, upload the module file to your store under Domain Settings -> Modules.
Finally, install the module to your store under System Extension Settings. Once installed you’ll see new tab for "Quantity Limits"
There is a single global setting to configure the min and max limits. This setting applies to all products in your store.
Default it is set to 0 – 0 which means there is no minimum and no maximum.
Invalid Quantity Template
There is also a configurable template which is used to output error messages to the customer on the Basket page when they have exceeded the max or not met the min quantity.
At the category level there are two configuration options:
Default Product Limits: Any values set here will apply to all products assigned to this category. If left at 0, this means there is no minimum and no maximum.
Important: If a product is assigned to 2 or more categories each with their own quantity limits, the most restrictive will always win out.
Example: The Shirt product is assigned to both bestsellers category and the apparel category. If Bestsellers has a max of 5 and Apparel has a max of 10, the lower of the two will be enforced so it will only a max of 5 for any product assigned to both categories.
These setting allow you to set a minimum or maximum cumulatively across all products purchased from this category. Let say for example you have a "Sale" Category and you want to force customers to buy at least 2 products from this category. You can set the cumulative minimum quantity to 2 and it will force the customer to buy at least 2 products assigned to the Sale category (any 2 products).
The module also supports product level configurations for min/max quantities. These settings have the highest priority so any value set here (other than the default 0 – 0) will override any other settings at both the category and globally.
You can set different quantity limits for each variant. Say for example you wanted a minimum quantity of 3 for the blue shirt but a minimum quantity of 5 for the red shirt. To do this, you would edit the variant part product to set the minimum quantity.
Important: If you have quantity limits set at both the master product level and its variants, all conditions must be met for each variant AND the master product. In a typical use case you would only set restrictions at the master product level or the variant level but not both.
Kits are treated the same way, however it uses the most restrictive settings for all parts in the kit when more than one part product has quantity limits.
Both the minimum and maximum values can be both imported and exported via CSV. These are added to the standard product import/export fields as custom field values.
To export the values, go to Data Management -> Export Products to Flat file
Here under Custom Fields you’ll see the two fields which you can select to be exported
Importing the values back into Miva uses the standard product import. The column headers need to be:
MINIMUM_PURCHASE_QUANTITY and MAXIMUM_PURCHASE_QUANTITY
XML Provisioning to update product minimum and maximum quantity custom fields:
Miva validates the quantity limits for the basket during the ORDR action. This is when the Bill To /Ship To fields are submitted (The OCST page). If there are any validation errors it will take the customer back to the basket page with the errors which need to be fixed displayed.
There is also a final validation check on the AUTH action which is when the order is attempting to be processed. If it fails this final validation, it will also redirect the customer back to the basket page any errors which exist.
There is an item which gets created upon module install. It gives you access to the three functions below.
Important: In order to use one of these functions on any page, the quanlimits item first needs to be assigned to that page. It does not get assigned to any pages by default upon install. Common pages to use it on would be BASK and PROD.
QuantityLimit_Load_Product( product_id, variant_id, limits var )
QuantityLimit_Load_Category( cat_id, limits var )
QuantityExceptionList_Load_Line( line_id, exceptions var )