> ## Documentation Index
> Fetch the complete documentation index at: https://order-limit.xrtotech.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Limit Shopify repeat samples with cart and history rules

> Combine a one-unit cart cap with recorded customer history to restrict repeat samples. Test first orders, record updates, sign-in and repeat checkout.

You want each customer to buy a particular sample only once. Cumulative rules do not cap a first purchase with no recorded history, so add a separate 1-unit cart rule.

## When to use this

Use this to manage sample repeats for one customer account. Two rules are required; a cumulative rule alone does not enforce a first-order cap.

## Before you begin

Prepare a non-subscription sample and a signed-in test customer with no recorded sample purchases. The first test must create an order; record its state and test time.

## Settings

Use **All quantity rules** and **Cumulative purchase rules** on the app home page.

| Setting | Example value |
| - | - |
| Rule A: type | Cart quantity limit |
| Rule A: maximum | 1 |
| Rule A: calculation | Limit each applicable item individually |
| Rule B: type | Cumulative customer purchase limit |
| Rule B: historical quantity threshold | 1 |
| Scope for both | Specific products: the same sample |
| Status for both | Active |
| Rule names | Sample maximum 1 per cart; sample history threshold 1 |
| Timing for both | Cart interactions and checkout |

## Steps

1. First create rule A with the [single-product steps](https://order-limit.xrtotech.com/en/scenarios/limited-release.md): the same sample, individual calculation, maximum `1`. Rule B below does not replace rule A.
2. Open **Apps** → **订单限购** in Shopify. From the app home page, open **客户累计规则** and click **创建规则**.
3. Enter the rule name and thresholds from the settings table. The name is for admin use only.
4. Under **规则应用于**, choose **指定产品** and click **选择产品**. Select the same sample as rule A and confirm its name. Cumulative rules do not support collections.
5. Set the timing from the table. Under **保存后的状态**, select **已启用** and click **创建并启用**. When editing an existing rule, click **保存并启用**.
6. Return to **数量限制** and turn on **开启数量规则**. Confirm **购物车与结账校验** is enabled, using **启用校验** if necessary.
7. Reopen the rule to confirm its thresholds, scope, customer conditions and active state were saved. Run the storefront tests below.
8. Create the first test order while signed in as the customer with no history. After the record updates, try checkout again using the same account and sample. Refunds or cancellations do not restore the allowance automatically.

## Test your configuration

Each result describes this recipe only. Keep the product scope consistent and verify checkout; other active rules may still block the cart.

| Test | Expected result for this scenario |
| - | - |
| Signed in, no history, first purchase of 1 | Allowed |
| Signed in, no history, first purchase of 2 | Blocked by rule A |
| Recorded history of 1, another purchase of 1 | Blocked by rule B |
| Guest enters checkout with the sample | Sign-in required |

> [!WARNING]
>
> This is not a daily, monthly or email-based allowance. Review first-purchase behavior, record-update delays and refunds before using it in a promotion.

Required reading: [cumulative purchase boundaries](https://order-limit.xrtotech.com/en/features/purchase-history.md).

## If results differ

If a first purchase of 2 passes, check rule A. If a repeat passes, check the same customer and product, non-subscription items and purchase-record updates.

Use [troubleshooting](https://order-limit.xrtotech.com/en/troubleshooting/rules-not-working.md) to investigate. Complete the [launch checklist](https://order-limit.xrtotech.com/en/getting-started/launch-checklist.md) before rolling out.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.