# Adding a Checkout Rule

**Requires:** Free plan

### Why this matters <a href="#why-this-matters" id="why-this-matters"></a>

Limit messages on the product page and cart are friendly nudges. A determined shopper can still bypass them — for example, by visiting `/checkout` from a saved link, sharing a cart URL, or ignoring the warnings. The checkout rule closes that back door by re-running the validation at the final step.

By setting this up, you protect your store from unexpected bulk purchases, avoid shipping complications, and keep your inventory balanced.

***

### Part 1: Register the validation in Shopify Admin <a href="#part-1-register-the-validation-in-shopify-admin" id="part-1-register-the-validation-in-shopify-admin"></a>

#### Step 1: Open Checkout rules in Shopify <a href="#step-1-open-checkout-rules-in-shopify" id="step-1-open-checkout-rules-in-shopify"></a>

In your Shopify admin, navigate to **Settings > Checkout > Checkout rules** and click **Add rule**.

![Add rule in Shopify Checkout rules](https://file+.vscode-resource.vscode-cdn.net/Users/vince/dev/shopify-app/order-limit/docs/User%20Guide/adding-checkout-rule/images/01-add-rule.png)

#### Step 2: Select Avada Order Limit's validation <a href="#step-2-select-avada-order-limits-validation" id="step-2-select-avada-order-limits-validation"></a>

In the dropdown, choose **Avada Order Limit > avada-order-limit-validation**. This connects the Shopify checkout step to Avada's validation function.

![Select avada-order-limit-validation](https://file+.vscode-resource.vscode-cdn.net/Users/vince/dev/shopify-app/order-limit/docs/User%20Guide/adding-checkout-rule/images/02-select-validation.png)

#### Step 3: Turn on the checkout rule <a href="#step-3-turn-on-the-checkout-rule" id="step-3-turn-on-the-checkout-rule"></a>

After saving in Shopify, make sure the new rule is **enabled** — toggle the switch next to the rule you just added.

![Enable the checkout rule](https://file+.vscode-resource.vscode-cdn.net/Users/vince/dev/shopify-app/order-limit/docs/User%20Guide/adding-checkout-rule/images/03-enable-rule.png)

***

### Part 2: Configure the rule inside Avada Order Limit <a href="#part-2-configure-the-rule-inside-avada-order-limit" id="part-2-configure-the-rule-inside-avada-order-limit"></a>

Once Shopify is registered, jump back into the Avada app to control how the validation behaves.

* Open Avada Order Limit and navigate to **Settings > Checkout rules**

The page is titled **Settings** and contains three cards: **Checkout validation**, **Rule settings**, and **Debug mode**.

![Checkout rules page in app](https://file+.vscode-resource.vscode-cdn.net/Users/vince/dev/shopify-app/order-limit/docs/User%20Guide/adding-checkout-rule/images/04-checkout-rules-page.png)

#### Step 4: Turn on Checkout validation <a href="#step-4-turn-on-checkout-validation" id="step-4-turn-on-checkout-validation"></a>

In the **Checkout validation** card, look at the **Checkout rules status** badge:

* If it reads **Off**, click **Turn on** — the badge flips to **On** (green) and the validation is active
* If it reads **On**, you're already covered

![Turn on checkout validation](https://file+.vscode-resource.vscode-cdn.net/Users/vince/dev/shopify-app/order-limit/docs/User%20Guide/adding-checkout-rule/images/05-turn-on-validation.png)

#### Step 5: Pick what happens if validation fails <a href="#step-5-pick-what-happens-if-validation-fails" id="step-5-pick-what-happens-if-validation-fails"></a>

Shopify's checkout rules can occasionally fail to execute (network blips, function timeouts, etc.). The **Rule settings** card lets you decide the fallback behavior. Under **If the checkout validation fails or experiences a problem**, choose one of the two radio options:

* **Allow customer to complete the checkout** — the app keeps working normally before checkout, but if a customer reaches checkout (e.g., via a direct link) the rules are not enforced and the order proceeds. Recommended for most stores to avoid blocking legitimate purchases.
* **Block customer from completing the checkout** — all orders are blocked as if a limit rule were violated. Safer for inventory but may stop legitimate orders during a function outage.

![Choose fallback behavior](https://file+.vscode-resource.vscode-cdn.net/Users/vince/dev/shopify-app/order-limit/docs/User%20Guide/adding-checkout-rule/images/06-rule-settings.png)

> **Tip:** It's recommended to pick **Allow customer to complete the checkout** unless you have strict inventory rules. A short outage of Shopify's checkout function is rare, but blocking every order during one will hurt revenue.

After choosing, click **Save** in the top bar to apply.

#### Step 6: (Optional) Share function logs for debugging <a href="#step-6-optional-share-function-logs-for-debugging" id="step-6-optional-share-function-logs-for-debugging"></a>

The **Debug mode** card is for troubleshooting. If something looks wrong — for example, a limit isn't enforced at checkout — our support team may ask you to share the checkout function's logs.

* Click **Share logs** on the right side of the Debug mode card

![Share function logs](https://file+.vscode-resource.vscode-cdn.net/Users/vince/dev/shopify-app/order-limit/docs/User%20Guide/adding-checkout-rule/images/07-debug-mode.png)

This opens the Shopify Apps page for Avada Order Limit. From there:

* Click the **action button (...)** next to **Avada Order Limit: Checkout Rules**
* Choose **View details**
* Scroll down to **Share function logs** and click **Share logs**

Once sharing is enabled, share the logs URL with our support team.

***

### Step 7: Verify end-to-end <a href="#step-7-verify-end-to-end" id="step-7-verify-end-to-end"></a>

Open your storefront in an incognito window and try to violate a limit at checkout:

* Add a quantity that exceeds your limit rule
* Skip the cart and go to `/checkout` directly (paste the URL if needed)
* The checkout should be blocked with a clear limit message

![Checkout blocked by validation](https://file+.vscode-resource.vscode-cdn.net/Users/vince/dev/shopify-app/order-limit/docs/User%20Guide/adding-checkout-rule/images/08-checkout-blocked.png)

If the order goes through anyway, recheck Part 1 (the rule must be added and enabled in Shopify) and Part 2 Step 4 (Checkout rules status must read **On** in the app).

***

### Tips <a href="#tips" id="tips"></a>

* **Both halves are required:** Registering the validation in Shopify (Part 1) without turning it on in the app (Part 2 Step 4) won't enforce anything — and vice versa.
* **Allow vs. Block trade-off:** "Allow" optimizes for smooth checkout; "Block" optimizes for strict inventory control. Pick based on which failure mode hurts your store more.
* **Logs are scoped per request:** Function logs are short-lived. If a customer reports an issue, grab the logs as soon as possible after the failed checkout.
* **No code editing needed:** Unlike the legacy snippet flow, the checkout rule is fully managed by Shopify Functions — there's nothing to paste into your theme.

***

That's the full setup. Your store now enforces order limits at every step — product page, cart, and checkout — with a clear fallback for the rare case Shopify's checkout function fails.

If you have any questions or run into any issues, don't hesitate to reach out. We're here to help!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avada.io/order-limit-help-center/settings/adding-a-checkout-rule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
