Zum Inhalt springen

Configuration

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Minimum is configured entirely from WooCommerce → Minimum. Everything is stored in one option, minimum_settings (a single array): the enforcement switch, the list of rules, the minimum order total and the four notice messages. The screen requires the manage_woocommerce capability.

A master on/off checkbox, labelled Enforcement and on by default (enabled in the option). Turn it off to keep every rule and the order-total saved but stop applying them at the cart and checkout, useful for a temporary sale or while you reorganise rules. With it off, Minimum adds no notices and blocks nothing.

Each rule row has a scope, a target ID, and the three quantity constraints.

  • All products (global), applies to every product. The target ID is ignored and forced to 0.
  • Specific product, applies to one product, matched by product ID or, for a variation, its parent product ID.
  • Product category, applies to products in the chosen product_cat term.

You can run rules at more than one scope at once; see How rules combine.

  • Min, require at least N units. 0 = no minimum.
  • Max, cap units per order. 0 = no maximum.
  • Step, quantity must be a multiple of this number (e.g. 6 allows 6, 12, 18). 0 or 1 = no step.

Rules are sanitised on save: a row that constrains nothing (min 0, max 0, step 0 or 1) is dropped, a non-global row with no valid target ID is dropped, and if the maximum is below the minimum the maximum is discarded so the minimum wins. Each value is stored as a non-negative integer.

A separate, store-wide rule (min_order_total): the cart subtotal must reach this amount before checkout is allowed. It is independent of the quantity rules, a floor on small orders regardless of which products are in the cart. Set it to 0 to disable. The amount is normalised through WooCommerce’s wc_format_decimal, so it follows your store’s decimal settings.

Four editable notices, each shown when its rule is unmet. The {token} placeholders are replaced with live values at validation time. Leave a field blank to fall back to the built-in default.

Setting keyDefault wordingTokens
msg_min_qtyYou must buy at least {min} of "{product}".{min}, {product}
msg_max_qtyYou can buy at most {max} of "{product}".{max}, {product}
msg_step_qty"{product}" must be bought in multiples of {step}.{step}, {product}
msg_min_totalYour order total must be at least {min} (currently {total}).{min}, {total}

In the order-total notice, {min} is the required minimum and {total} is the shopper’s current subtotal, both rendered as formatted prices in your store currency. {product} is the product (or variation) name. Tokens that do not apply to a given notice are left untouched, so only the tokens listed above are substituted per message.

For each constraint, min, max and step, the most specific matching rule wins, resolved independently:

  1. A product rule (weight 3) beats
  2. a category rule (weight 2), which beats
  3. the global rule (weight 1).

Because each constraint resolves on its own, one product can take its minimum from a product rule and its step from a category rule if that is how your rules are arranged. A field left at 0 in the winning rule does not block a less specific rule from supplying that value. The minimum order total is always evaluated against the cart subtotal, separately from the quantity rules.

Validation runs at three WooCommerce points, so a rule cannot be slipped past:

  • woocommerce_add_to_cart_validation, adding a quantity that breaks a rule is rejected. The minimum check counts what is already in the cart for that product, so two adds that together fall short are still caught.
  • woocommerce_check_cart_items, the cart page re-validates every line and surfaces notices; duplicate notices for the same product are de-duplicated.
  • woocommerce_after_checkout_validation, a hard block on the classic checkout.

All three read the live cart, so the same rules hold in the classic and the block-based cart and checkout. Minimum is declared compatible with HPOS and the Cart and Checkout blocks.

minimum/product_constraints lets add-ons override the resolved constraints for a product after the global/category/product rules have been merged. Minimum Pro uses it to layer per-product overrides. Return the same array{min, max, step} shape:

add_filter(
'minimum/product_constraints',
function ( array $constraints, int $product_id ): array {
// Force a step of 12 on product 1234, keep its other constraints.
if ( 1234 === $product_id ) {
$constraints['step'] = 12;
}
return $constraints;
},
10,
2
);

The $product_id passed is the variation ID when a variation is in play, otherwise the product ID.

All settings are in the single minimum_settings option; a minimum_db_version option tracks the schema version for first-run seeding. There are no custom database tables and no external services. Deleting the plugin runs the uninstall routine, which removes both options and leaves your database exactly as it was.