Skip to Content
SectionsQuantity rules

Quantity rules

ProProductBest as a block in Product informationv1.0.0

Stop rejected carts and confused buyers. The picker reads each variant's quantity rules from Shopify (minimum, maximum and increment, set in B2B catalogs) and only steps through amounts Shopify will accept. Buyers can order by the unit, by the case or by the pallet, with pack sizes from your settings or from a product or variant metafield, and always see how many units that is. Type an amount that doesn't fit and it suggests the nearest valid ones. Prices follow the buyer's volume price breaks. On the product page it sets your product form's quantity, so your Add to cart buys it; anywhere else it adds through Shopify's standard cart actions.

Good for: Wholesale and B2B product pages · Selling by the case or pallet · Minimum order quantities

Quantity rules on a storefront

When to use it

Use it on product pages for wholesale and B2B buyers, right beside the price and Add to cart, in place of your theme’s quantity field.

  • No rejected carts. The picker reads each variant’s minimum, maximum and increment from Shopify and only steps through amounts Shopify accepts. If a buyer types an amount that doesn’t fit, it suggests the nearest valid ones.
  • Order by the case or pallet. Buyers can count in units, cases or pallets, and always see how many units that is.
  • The price at a glance. It shows the unit price and the total, following the buyer’s volume price breaks.

Set it up

Add it beside Add to cart

This section is best as a block in Product information: open your product template, select Product information, choose Add block and pick SU: Quantity rules. See Sections beside Add to cart, which also covers themes without theme blocks (there you choose Add section instead).

On a product page it uses that page’s product. Elsewhere, for example in a featured product section, pick one under Product.

Set the order rules in Shopify

The minimum, maximum and increment come from the quantity rules in your Shopify B2B catalogs. You don’t enter them in the section. Buyers who aren’t covered by a catalog with quantity rules can order any amount from 1.

If you track inventory for a variant and don’t let it sell when out of stock, the stock count also caps the amount buyers can choose.

Name your units

Fill in Unit (one) and Unit (many), for example bottle and bottles. These words show next to the quantity and in the totals.

Set up your packs

The first pack is a case by default: Pack (one) and Pack (many) are case and cases, and Units per pack is 12. Change them to match how you ship, or clear Units per pack for no pack.

If pack sizes differ from product to product, store them in an integer metafield on the variant or the product and enter its namespace.key in Units per pack metafield. It’s set to custom.case_qty by default. When a product has a value there, it replaces Units per pack; a variant’s value comes before the product’s. Clear the field to always use the number.

For a second, larger pack, fill in Large pack (one), Large pack (many) and Units per large pack (or Units per large pack metafield). It’s off until you enter a size.

A pack is only offered when it fits the variant’s rules: its size must be a multiple of the increment and stay within the maximum. When a pack doesn’t fit, the theme editor shows a note explaining why.

Choose what buyers start with

Buy by, at first picks whether the picker opens on Unit, Pack or Large pack. If that pack doesn’t fit the variant’s rules, it starts on the unit.

Work with your theme’s form

On the product page, the picker sets your product form’s quantity, so your theme’s Add to cart buys the amount. Keep Hide the product page’s own quantity on so buyers don’t see two quantity fields; the hidden one keeps working.

Off the product page, the section has its own option picker and Add to cart button. Turn off Show add to cart button if another Section Universe block for the same product should carry the button.

Choose what shows

Under Display, Show order rules lists the minimum, increment and maximum. With it on, Show stock count also shows how many are in stock. Show price and total shows the unit price, the total and the price per pack. Placed as a section, Look chooses between Blend with the theme and Card.

Quantity rules and volume prices belong to B2B catalogs, so buyers only get them when they’re signed in to a company account that has the catalog. To check the picker with your rules, sign in to your store as one of those customers.

Quantity rules: Buying by the case: the quantity counts cases and shows the units.
Buying by the case: the quantity counts cases and shows the units.

Try it

Live example with sample products. Links and checkout are turned off; Add to cart shows what shoppers would see.

Settings

In the theme editor, in the order you'll see them. Every section also has the heading and style settings.

Quantity

SettingWhat it does
ProductProductLeave empty on product pages to use the page's product.
Show add to cart buttonCheckboxOff the product page it buys on its own. With several Section Universe blocks for one product in a section, one button shows: the last one switched on. On the product page your theme's button is used.Default: On
Hide the product page's own quantityCheckboxOn the product page this sets your product form's quantity; hiding the theme's field avoids two. It keeps working out of sight.Default: On

Units and packs

SettingWhat it does
Unit (one)TextDefault: unit
Unit (many)TextDefault: units
Pack (one)TextDefault: case
Pack (many)TextDefault: cases
Units per packNumberLeave empty for no pack.Default: 12
Units per pack metafieldTextnamespace.key of an integer metafield on the variant or product. When set, it replaces the number above.Default: custom.case_qty
Large pack (one)TextDefault: pallet
Large pack (many)TextDefault: pallets
Units per large packNumberLeave empty for no large pack.
Units per large pack metafieldTextnamespace.key of an integer metafield on the variant or product.
Buy by, at firstDropdownFalls back to the unit when the pack doesn't fit the order rules.Options: Unit, Pack, Large packDefault: Pack

Display

SettingWhat it does
Show order rulesCheckboxDefault: On
Show stock countCheckboxStock always limits the amount buyers can choose; this also shows the count.Default: OffShown when “Show order rules” is on.
Show price and totalCheckboxDefault: On
LookDropdownOptions: Blend with the theme, CardDefault: Blend with the theme

Good to know

  • Quantity rules come from Shopify B2B catalogs; for buyers without them every amount from 1 is valid.
  • A pack is offered only when its size fits the variant's rules (a multiple of the increment, within the maximum).
  • Pack sizes from metafields need an integer metafield (for example custom.case_qty) on the variant or product.
  • Off the product page (for example in a featured product section) it has its own option picker and Add to cart, separate from the theme's.
  • Without JavaScript buyers enter the number of units in a field limited to the order rules, and the form adds it to the cart.
Accessibility: Pack choice is a labelled radio group, the quantity field is labelled with its rules, and suggestions and totals are announced in a live region; suggestions are buttons that set the amount.

Speed: Rendered in Liquid from the product's variants; the script only redraws a few elements as the buyer changes the quantity. No extra requests.

Changelog

  • 1.0.0: Initial release.
Last updated on