> ## Documentation Index
> Fetch the complete documentation index at: https://codebeans-cb-checkout-rules.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom rules

> Build your own checkout rules from conditions on the cart, the customer, the address and the delivery method.

A custom rule blocks checkout when the order meets conditions you choose. For example: *block checkout when the cart contains a fragile product **and** the address is a P.O. Box*.

> [!NOTE]
>
> Conditions describe the orders you want to **block**. If the conditions are true, checkout stops and the customer sees your message.

## How a custom rule is built

![A rule block with When Match set to All Conditions, two conditions joined by AND, and an action with a target and an error message.](https://mintcdn.com/codebeans-cb-checkout-rules/9lVKcptiAqYAtTXj/images/custom-rule-anatomy.svg?fit=max\&auto=format\&n=9lVKcptiAqYAtTXj\&q=85\&s=9a1d3a66b910952f57623a23f6261a14)

One rule block: block US orders with a subtotal under \$50.

| Part | What it is |
| - | - |
| **Condition set** | The group of conditions you can use in this rule. You choose it once, when you create the rule. See [Condition sets](https://codebeans-cb-checkout-rules.mintlify.site/custom-rules/condition-sets.md). |
| **Rule block** | One check: a list of conditions, plus the message to show when they match. A rule can have several blocks. |
| **Condition** | A field, an operator and a value, for example *Total amount · Is less than or equal to · 50*. See [Operators](https://codebeans-cb-checkout-rules.mintlify.site/custom-rules/operators.md). |
| **When Match** | **All Conditions** blocks checkout only when every condition is true. **Any Conditions** blocks it when at least one is true. |
| **Action** | Where the message appears on the checkout page, and the message itself, in each of your languages. |

## Create a custom rule

**1. Open the builder**

On the **Home** page, click **Add new rule** and choose **Custom Rule**.

**2. Name the rule**

Under **Rule Details**, enter a **Rule title** that describes what the rule blocks, for example *Minimum order for US*. Only you see the title.

**3. Choose a condition set**

Under **Choose condition set for this custom rule**, click a set. Click **N conditions** on a set to see which conditions it includes. Sets that aren't in your plan are marked with a badge.

> [!WARNING]
>
> You can't change the condition set after the rule is saved. Switching sets before you save clears every condition you've added.

**4. Add conditions**

In the rule block, choose **All Conditions** or **Any Conditions** under **When Match**. Then, for each condition, choose a **Field**, an **Operator** and a value. Click **+ Add condition** to add more.

**5. Set the action**

Under **Action**, choose the **Target**, which is where the message appears on the checkout page. Then write the message under **Translation for error message**. English is required.

**6. Add more rule blocks (optional)**

Click **+ Add another rule block** to add another check, with its own conditions and message. With two or more blocks, choose a **Rule Application Mode**.

**7. Check the preview and save**

The **Preview** card on the right explains the rule in plain words, and lists anything that is still missing. Choose a status, then click **Save**.

## Rule Application Mode

When a rule has two or more rule blocks, choose how they work together:

![With Apply all matching rules, every matching block shows its message. With Apply only the first matching rule, checking stops at the first match and later blocks are skipped.](https://mintcdn.com/codebeans-cb-checkout-rules/9lVKcptiAqYAtTXj/images/apply-mode.svg?fit=max\&auto=format\&n=9lVKcptiAqYAtTXj\&q=85\&s=8d3249d8b2f46888efc6241ddf05d0cc)

> [tab] Apply all matching rules
>
> Every block is checked. Each block whose conditions match shows its own message. Use this when the blocks check unrelated problems.

> [tab] Apply only the first matching rule
>
> Blocks are checked in order, from top to bottom. When one matches, its message is shown and the remaining blocks are skipped. Use this when you want the customer to see one message at a time, with the most important block first.

## Rule Complexity Budget

Shopify limits how much data a checkout rule can hold. The **Rule Complexity Budget** bar shows how much of the 10,000-byte limit your rule uses. When you go over the limit, the **Save** button is disabled. To reduce the size, remove conditions, use shorter values or messages, or split the rule into two rules.

## Status and checkout behavior

Custom rules use the same **Rule status** (Active, Testing, Deactivated) and **Checkout behavior** settings as preset rules. See [Rule status and testing](https://codebeans-cb-checkout-rules.mintlify.site/rules/rule-status-and-testing.md) and [Common rule settings](https://codebeans-cb-checkout-rules.mintlify.site/rules/common-settings.md#checkout-behavior).

> [!NOTE]
>
> Custom rules don't have a separate country setting. To limit a custom rule to certain countries, add a **Country / region** condition.

## How many custom rules you can have

| Plan | Custom rules |
| - | - |
| Free | Not included |
| Starter | 1 |
| Growth | 10 |
| Enterprise | Unlimited |

Deactivated custom rules don't count toward the limit. When you reach it, the builder shows **Custom rule limit reached** with a link to upgrade.

## Can't find the condition you need?

Click **+ Request condition** in the builder, or [contact us](https://codebeans-cb-checkout-rules.mintlify.site/help/support.md). Tell us what you want to check, and we'll let you know how to set it up.


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