For the complete documentation index, see llms.txt. This page is also available as Markdown.

Order quantity

Match customers whose total order count meets a minimum — good for loyalty and repeat-buyer perks.

Order quantity matches a customer based on how many orders they've placed with your store in total, rather than what they bought. It's a good fit for loyalty or repeat-buyer perks — for example, unlocking a discount code or an exclusive product only for customers who've ordered from you a certain number of times before.

Like most access rules (aside from the action-based ones such as Passcode, Secret link, Subscribe, and Confirmation prompt), Order quantity can be set to match If the customer meets the order-count threshold, or Unless they don't — inverting it to match customers below the threshold instead. See Combining rules.

This rule reads order history from a signed-in Shopify customer account. With If, a guest cannot meet the order threshold; with Unless, a guest has no matching order history and therefore satisfies the inverted condition.

Add the rule

  1. Open Locks and create a new lock, or open an existing one to edit it.

  2. Choose the content you want to protect. See Access rules overview for how rules fit into a lock.

  3. Click the Unlock rules tab, then in the Condition type dropdown, select Order quantity.

The Unlock rules tab with Order quantity selected in the Condition type dropdown.
Select Order quantity from the Condition type dropdown on the Unlock rules tab.
  1. Set the Order threshold — the minimum number of orders the customer must have placed for the rule to match. The default is 1 order.

  2. Ignore cancelled orders is on by default, so cancelled orders don't count. Untick it if you want them included.

The Order quantity rule settings, showing the order threshold field and the Ignore cancelled orders checkbox.
Set the minimum number of orders a customer must have placed, and choose whether cancelled orders count.
  1. Choose If or Unless.

  2. Click Save.

Example: Unlock rewards after three orders

Suppose customers should be able to open a rewards page after placing at least three non-cancelled orders.

  1. Select the Repeat-customer rewards page as the content to protect.

The Lock setup tab with Specific Page as the content type and the Repeat-customer rewards page listed under Restricted pages.
Pick the page that repeat buyers should unlock.
  1. On the Unlock rules tab, set Condition type to Order quantity and leave Rule logic on If.

  2. Set Order threshold to 3. Leave Ignore cancelled orders ticked — it's on by default.

The Order quantity condition with Rule logic If, Order threshold set to 3, and Ignore cancelled orders ticked.
The condition heading reads: If the customer order quantity matches.
  1. Leave the rule's Redirect URL empty.

  2. In Messages, set the Access denied message to:

Sign in with an account that has placed at least 3 orders to unlock these rewards.

Order quantity shows only the Access denied message — there's no Guest message field, because the rule isn't one of the five customer-identity rules. See Access rules overview.

The Messages card with a single Access denied message field set to the three-order wording, and the Preview panel rendering it.
The Preview panel confirms the wording before you save.
  1. Click Save.

Result on the storefront

A signed-in customer with at least three counted orders can open the rewards page. A guest or a customer with fewer than three counted orders sees the Access denied message above.

The Repeat-customer rewards page displaying the configured three-order requirement.
A visitor without three qualifying orders sees the Access denied message from this example.

Last updated

Was this helpful?