Purchase Rules
Purchase Rules are the controls in Salesforce B2B Commerce that decide what a buyer is allowed to order and in what quantity.
Definition
Purchase Rules are the controls in Salesforce B2B Commerce that decide what a buyer is allowed to order and in what quantity. In current Salesforce documentation the feature appears as Purchase Quantity Rules, backed by the PurchaseQuantityRule object, with related entitlement policies governing which products a buyer group can even see.
A Purchase Quantity Rule sets the minimum, increment, and maximum amount of a product a customer can add to the cart. The storefront enforces those limits at the point of purchase, so a buyer cannot order 3 units when the contract says they buy in cases of 12.
How quantity and entitlement controls shape a B2B order
Why B2B buying needs rules at all
B2B selling does not work like a consumer checkout. A buyer at a distributor orders against a negotiated contract, with case packs, account-specific catalogs, and quantity minimums that the storefront has to respect. Purchase Rules are the part of Salesforce B2B Commerce that turns those commercial terms into something the cart actually enforces. Two mechanisms do most of the work. Purchase Quantity Rules constrain how many units of a product a buyer can order. Entitlement policies constrain which products a buyer group can see and whether they see prices. Together they keep the storefront honest. A buyer cannot order a half pallet when the product ships in full pallets, and cannot purchase an item that was never part of their agreement. Salesforce builds these controls in the data layer rather than the page design for a good reason. A storefront can hide a product from a buyer, but only a rule stops that buyer from adding it through a saved link or an API call. The rule is the guardrail that holds when the UI is bypassed.
What a Purchase Quantity Rule actually sets
A Purchase Quantity Rule has three numeric values plus a name. The Minimum is the lowest quantity a customer can buy. The Increment is the fixed step added each time the buyer increases the amount. The Maximum is the highest quantity a customer can buy. Salesforce requires the three values to be compatible multiples. If the minimum is 4, the maximum is 400, and the increment is 2, all three divide cleanly by the increment. Whole numbers are supported up to one hundred million. B2B stores also allow fractional quantities with up to four decimal places, which matters for products sold by weight or length, such as 1.5000 or 1000.5000. The rule applies to simple products and to product variations. Parent products do not take a quantity rule because they are not sold directly. The buyer is what gets sold, so the rule lives on the sellable record. This is why a configurable product with several variants gets a rule on each variant rather than on the parent.
Where the buyer sees and hits the rule
The rule is not a back-office setting that buyers never notice. On the storefront, the Quantity Selector component shows the constraints, usually behind an information icon that lists the minimum, increment, and maximum. When a buyer types a quantity that breaks a rule, the store does not silently accept it. The Cart Items and Product Detail Purchase Options components also surface these values so the buyer understands the step size before adding to the cart. Enforcement happens at the point of adding to the cart and again through checkout, so a stale cart cannot slip a non-compliant quantity into an order. For the admin, this means the display text and the enforcement come from the same rule, with no second place to keep in sync. You set the numbers once on the product, and the storefront components read them. If a buyer ever reports that they can order an odd quantity, the first place to look is whether a rule is assigned to that specific variation rather than only to the parent.
Entitlement policies, the other half of Purchase Rules
Quantity is only one constraint. The other is access. Entitlement policies decide which products a buyer group can see and whether the buyers can see prices. When you create a B2B store, Salesforce generates a default buyer group and a matching entitlement policy automatically, so a new store is not wide open by accident. A store can have multiple buyer groups and markets. You can assign products to multiple entitlement policies and associate those policies with different buyer groups, which is how one storefront serves several customer segments from one catalog. The backing object is CommerceEntitlementPolicy, with entitlement products linking a policy to the items it grants. For very large catalogs, preconfiguring entitlement policies product by product gets unwieldy. Salesforce documents qualification and disqualification rules as the scalable alternative, letting you grant or block products by criteria instead of listing thousands of assignments. Used together, entitlement policies and quantity rules answer two separate questions: can this buyer purchase this product, and if so, how many.
Enabling rules and assigning them to products
Before a Purchase Quantity Rule can be assigned, the Product object needs the Quantity Rule related list on its page layout. That is the one-time enablement step in Object Manager. After that, the day-to-day work happens in the Commerce app under Merchandising and Products. You open a simple product or a product variation, go to the Related tab, and assign a quantity rule next to Quantity Rules. You can pick an existing rule or create a new one inline by entering the minimum, increment, and maximum and naming it. Because a single rule can be reused across many products, a common pattern is to build a small library of named rules, such as Case of 12 or Pallet Only, and attach the right one to each product. The display text shown to buyers comes from the Quantity Selector component properties in Experience Builder, so the merchandising team controls the wording without touching the rule values. Keep the rule name descriptive. A name like Min10 Inc5 reads cleanly in the related list when you have dozens of products to audit.
The older Visualforce B2B Commerce lineage
Purchase Rules did not start in Lightning. The earlier Salesforce B2B Commerce for Visualforce platform, originally CloudCraze, exposed the same idea through its own managed package. There, product quantity rules were handled by the ccrz.cc_api_ProductQuantityRule Apex API and stored on CloudCraze custom objects in the ccrz namespace. Developers fetched and applied rules in code as part of the storefront logic rather than configuring them on a standard Product page layout. If you inherit an older B2B Commerce implementation, you may still see this ccrz-based approach in the org. The newer Lightning B2B Commerce model moves the same controls onto standard objects like PurchaseQuantityRule and standard components, which is why current setup is mostly declarative. Knowing both lineages helps when you read documentation, because a search for B2B Commerce purchase rules can return Visualforce-era developer pages alongside the modern Help articles. For new builds, follow the Lightning Experience path with the Commerce app and the standard objects.
Create a Purchase Quantity Rule for a B2B store
Create and assign a Purchase Quantity Rule so a B2B store enforces minimum, increment, and maximum order quantities for a product. Enable the related list first, then build the rule.
- Add the Quantity Rule related list
In Object Manager, open the Product object, edit the page layout, and add the Quantity Rule related list. This one-time step lets you assign rules to products.
- Open a sellable product
In the Commerce app, go to Merchandising, then Products, and open a simple product or a product variation. Parent products are skipped because they are not sold directly.
- Assign a quantity rule
On the Related tab, next to Quantity Rules, click Assign. Choose New Quantity Rule to build one inline, or select an existing named rule to reuse it.
- Enter the rule values
Set the Minimum, Increment, and Maximum so all three are compatible multiples, give the rule a clear name, and save. The storefront Quantity Selector then shows and enforces these limits.
The lowest quantity a customer can buy. Must be a multiple of the increment.
The fixed number of items added each time the buyer increases the amount.
The highest quantity a customer can buy. Must be a multiple of the increment, up to one hundred million for whole numbers.
A descriptive label for the rule, such as Case of 12, used to identify and reuse it across products.
- Minimum, increment, and maximum must be compatible multiples, or the rule will not save.
- Assign rules to simple products and variations, not to parent products, which are not sold directly.
- B2B stores allow fractional quantities up to four decimal places; B2C behavior differs, so confirm the store type.
- Quantity rules control how many, not which products. Use entitlement policies to control what a buyer can see and purchase.
Prefer this walkthrough as its own page? How to Purchase Rules in Salesforce, step by step
Trust & references
Cross-checked against the following references.
- Purchase Quantity Rules for a B2B StoreSalesforce
- Entitlement Policies for B2B StoresSalesforce
Straight from the source - Salesforce's reference material on Purchase Rules.
Hands-on resources to go deeper on Purchase Rules.
About the Author
Dipojjal Chakrabarti is a B2C Solution Architect with 29 Salesforce certifications and over 13 years in the Salesforce ecosystem. He runs salesforcedictionary.com to help admins, developers, architects, and cert/interview candidates sharpen their fundamentals. More about Dipojjal.
Test your knowledge
Q1. What do Purchase Rules enforce in Salesforce B2B Commerce?
Q2. Why are Purchase Rules enforced in the data layer rather than only in the storefront UX?
Q3. When should a team build Purchase Rules for a B2B Commerce storefront?
Discussion
Loading discussion…