PS PrestaShop Intermediate

Minimum quantity and pack multiples: DataFirefly Minimums documentation

Installation, settings, quantity rules (minimum, multiple, maximum), mix and match, order minimums per group, CSV import and troubleshooting.

Updated Module version 1.0.0

Installation

Install the module from Modules > Module Manager > Upload a module using the ZIP file, or drop the dfminimums folder into the /modules/ directory of your shop and click Install.

On install, the module creates two tables (quantity rules and order minimums), registers its hooks and adds two tabs under the Catalog menu: Minimums and multiples and Order minimums.

On products managed by the module, keep the native minimum quantity of the product page at 1. PrestaShop still checks it on its own, and a different value can contradict the module’s rule.

Module settings

The module configuration page holds six settings.

Enable purchase rules

Main switch. When disabled, no rule is displayed or enforced in the shop. Rules stay saved.

Adjust quantities automatically

When a customer adds a quantity that breaks a rule, the module replaces it with the nearest allowed quantity: rounded up when adding, down when removing. Adding 7 of a product sold by 6 gives 12, going from 12 to 11 gives 6. Customized lines are never modified. When disabled, the quantity stays as it is and the cart is blocked until the customer fixes it.

Show conditions on the product page

Shows a box under the add to cart button with the minimum, multiple and maximum that apply to the logged-in customer. The box also appears in quick view.

Show a badge in product lists

Adds a short badge under the price of product miniatures, for example “Sold by 6” or “Min. 12”.

Show conditions under each cart line

Recalls the condition of each line and shows the error in red when the quantity is not allowed.

Customer in several groups

Decides which order minimum applies when a customer belongs to several groups that each have a minimum: the one of their default group, the highest or the lowest.

Creating a quantity rule

Open Catalog > Minimums and multiples and click Add a rule.

Applies to

  • A product: search the product by name, reference, EAN or ID, then optionally pick a combination. A rule on a combination takes precedence over a rule on the whole product.
  • A category: pick the category and say whether subcategories are included. Every product associated with the category is concerned, whatever its default category.
  • All products: the rule targets the whole catalog.

Customer group

Keep “All customer groups” or pick a group. A group rule applies to every customer who belongs to that group, even when it is not their default group.

Minimum, multiple and maximum

  • Minimum quantity: 0 or 1 means no minimum. When a multiple is set and the minimum is not one of its multiples, it is rounded up: minimum 10 by 6 gives 12.
  • Sold in multiples of: 1 leaves the quantity free, 6 only accepts 6, 12, 18 and so on.
  • Maximum quantity: 0 means no maximum. The maximum must be a multiple of the chosen multiple and greater than or equal to the minimum.

A rule must set at least a minimum above 1, a multiple above 1 or a maximum.

Which rule applies

For each product in the cart, one “per product” rule applies. The module picks it in this order:

  1. the highest priority;
  2. at equal priority, the most specific rule: combination, then product, then category (deepest first), then all products;
  3. at equal specificity, a customer group rule before a rule for all groups.

Example: a “Wines, sold by 6” rule for all customers and a “Wines, sold by 12” rule for the Trade group. A trade customer orders by 12, a retail customer by 6.

The module panel in the Modules tab of the product page lists the rules targeting the product directly and the category or catalog rules that can also apply.

Mix and match per category

On a category rule, the How to count field offers two values.

  • Each product separately: the rule applies to each product of the category, like a product rule.
  • All products of the category together (mix and match): the minimum, multiple and maximum apply to the sum of the quantities of every product of the category in the cart.

Example: minimum 12 and multiple 6 in mix and match on the Wines category. The customer can take 4 reds, 4 whites and 4 rosés. With 13 bottles in total, the cart is blocked.

Mix and match rules are checked on top of each product’s own rule. A wine sold by the unit stays available by the unit, as long as the category total meets the mix and match rule.

Order minimums per group

Open Catalog > Order minimums and click Add an order minimum.

  • Customer group: one minimum per group. The “All customers (fallback)” entry applies to customers whose groups have no dedicated minimum.
  • Minimum amount: entered in the shop default currency, converted automatically for carts in another currency. Shipping is never included.
  • Amount including tax: No compares the amount with the products total excluding tax, which is usual in B2B.
  • Deduct vouchers: Yes takes the total after cart rules and vouchers.

The native minimum purchase total (Shop Parameters > Order Settings) stays active and applies to everyone. Set it to 0 if you only want the per group minimums to count.

What the customer sees

When the cart breaks a rule, the module fills the cart’s minimalPurchaseRequired key, the one PrestaShop uses for its own minimum amount. The checkout button is disabled and the native cart alert shows “Your cart does not meet the purchase conditions yet.” followed by the detail of each problem: quantity not allowed with the possible quantities, category total in mix and match, amount left to add to reach the order minimum.

The check runs again when the order page opens: a customer who tries to reach it directly is sent back to the cart.

On the front office, quantity inputs follow the rule. On the Classic theme, TouchSpin buttons step by the multiple. On Hummingbird, the +/- buttons jump straight to the next or previous allowed quantity.

CSV import and export

The import sits at the top of the rule list. The file accepts the ; or , separator and needs a header line with at least the scope column. Recognised columns:

  • name: internal name, generated when empty;
  • scope: product, category or all;
  • product_id or product_reference;
  • combination_reference: combination reference;
  • category_id and include_subcategories (0 or 1);
  • apply_mode: per_product or cumulative (mix and match);
  • group_id: 0 for all groups;
  • min_qty, multiple, max_qty, priority, active.

The “Delete all existing rules of this shop first” box replaces the whole rule set. Lines in error are listed with their number and do not block the others. The Export CSV button produces the same format, handy to copy rules from one shop to another. A sample file can be downloaded from the import block.

Good practice

  • Start with a broad rule (category or catalog) then add product exceptions: the most specific rule wins without touching priority.
  • Keep priority for cases where a less specific rule must win, for example a category rule that must override all its products.
  • Test with a customer account from each group involved: group rules are not visible to a guest visitor.
  • After a change, clear the cache if your shop uses a full page cache module.

Troubleshooting

The customer cannot go below a quantity although no rule requires it

Check the native minimum quantity of the product page (Stocks or Quantities tab depending on the version) and set it back to 1.

The cart is blocked with the native minimum amount message

This is the native minimum from Shop Parameters > Order Settings. Set it to 0 if only per group minimums should count.

The +/- buttons step by 1

The theme does not use the standard Classic or Hummingbird selectors. The rule is still enforced server side: the cart is corrected or blocked. Contact us with the theme name for an adaptation.

A one page checkout module lets the order through

The third party module ignores minimalPurchaseRequired. Test it on a staging shop and contact us with its name.

Compatibility

  • PrestaShop 8.0 to 9.x, the same ZIP covers both branches.
  • Classic and Hummingbird themes.
  • Multistore: rules and minimums are saved per shop.
  • ModuleAdminController architecture, no Composer dependency, PHP 7.2 and above.
  • Interface available in English, French, Spanish, German, Italian, Dutch, Polish and Portuguese.
Was this page helpful?

Still stuck? Contact support