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

# Validate/block checkout

> Show errors or block invalid (or not allowed) checkout under given conditions.

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/2uuFCTbMXDc?si=w-vnBKR2evHYfkGM" title="BeSure Validate/Block Checkout" style={{ border: 0 }} allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

## Rule overview

This rule allows you to validate or block the checkout process based on defined conditions. You can show custom error messages or completely prevent checkout when certain criteria is met, such as invalid cart contents, restricted shipping regions, customer tags, or missing product attributes, etc.

This helps enforce business rules, prevent unsupported orders, and guide customers to resolve issues before completing the checkout.

## Sample configuration

The following steps show how to create and configure a **Validate/Block Checkout** rule using the app.

### Create a new rule

From your [Shopify admin](/guides/en/get-started/installation#go-to-the-app), open the app. In the sidebar, go to the [Rules](/guides/en/get-started/quickstart#create-a-sample-rule) section and click *"Create Rule"*.

Then, You’ll be redirected to the **Select checkout rule type screen**. Choose *category "Validation " → select checkout rule type "Validate/Block Checkout" → click “Select Rule”*.

<img src="https://mintcdn.com/storespark/ZoBcc0QT_aT_tX8T/images/essentials/validation/select-validation-block-rule.webp?fit=max&auto=format&n=ZoBcc0QT_aT_tX8T&q=85&s=9c25afd60ed06a93e3d1033554ed83aa" alt="Select Validation Block Rule" width="981" height="517" data-path="images/essentials/validation/select-validation-block-rule.webp" />

Next, you’ll land on the **Create new validate/block checkout rule** screen, where you can configure your rule.

### Rule configuration

To configure the rule, first optionally we can add a name such as "Validate/block checkout" to describe what it does. Then, select the rule [status](/guides/en/get-started/concepts#status): Testing, Active, or Deactivated.

Here we are going to choose **Testing** status, so we can quickly test the rule without affecting the checkout for actual customers.

<img src="https://mintcdn.com/storespark/ZoBcc0QT_aT_tX8T/images/essentials/validation/rule-configure-1-validation-block-rule.webp?fit=max&auto=format&n=ZoBcc0QT_aT_tX8T&q=85&s=8eaa4bee2fceaf1c111a8493e122a1e8" alt="Rule Configure 1" width="973" height="485" data-path="images/essentials/validation/rule-configure-1-validation-block-rule.webp" />

Next, on the same screen, select at least one option under [Trigger this rule](/guides/en/get-started/concepts#trigger). You can choose **Interacting with the checkout**, which runs the rule while the customer is in the checkout process, and **Completing the checkout** which runs the rule when the customer finishes the checkout. By default, you should select both options to ensure the rule always runs when it needs to.

<Info>
  If you are unsure about what to choose for any rule settings, many times the
  default preselected option is the best choice. You can always start with the
  default option and modify it later.
</Info>

<img src="https://mintcdn.com/storespark/lkY0mx0uZwe--5lB/images/concepts/trigger.webp?fit=max&auto=format&n=lkY0mx0uZwe--5lB&q=85&s=5bbeec7d9e4ea6937ae4b797f2315df9" alt="Trigger" width="960" height="129" data-path="images/concepts/trigger.webp" />

Next, on the same screen, select the relevant [condition set](/guides/en/get-started/concepts#condition-set), [condition](/guides/en/get-started/concepts#conditions-when), and [action](/guides/en/get-started/concepts#action-what).

> As an example, here we are using the default **Condition set 1**, setting the rule to trigger when the **"Address line 2 (Apartment, suite, etc)"** field is **empty**, and configuring it to block checkout. The error message **"Enter complete address"** will be displayed under the **Address line 2** field at the checkout, requiring customers to provide their complete address before proceeding.

<img src="https://mintcdn.com/storespark/ZoBcc0QT_aT_tX8T/images/essentials/validation/condition-set-validation-block-rule.webp?fit=max&auto=format&n=ZoBcc0QT_aT_tX8T&q=85&s=9df37e807749a292a3afeba9d8884440" alt="Condition Set" width="913" height="905" data-path="images/essentials/validation/condition-set-validation-block-rule.webp" />

In the **Action** section, you can choose the **target location** where your custom error message will appear on the checkout page. The dropdown menu provides a list of placement options:

* Under the **General** category, you can select **"Top of the checkout page"** to display the action at the very top.

* Under **Below these Input fields**, you can select to show the action below specific input fields, such as: Email, Customer phone number, Country, First name, Last name, Company, Address (Address line 1), Apartment, City, Province / state, Zip code / Postal code, Shipping phone number.

This gives you control over where the error message appears, helping you place it in the most relevant section of the checkout form.

<img src="https://mintcdn.com/storespark/ZoBcc0QT_aT_tX8T/images/essentials/validation/action-target-dropdown.webp?fit=max&auto=format&n=ZoBcc0QT_aT_tX8T&q=85&s=6affbfc1a9a112855a45bbac81c12d82" alt="Action Target Dropdown" width="903" height="423" data-path="images/essentials/validation/action-target-dropdown.webp" />

Next, on the same screen, select how the system should behave in the rare case, if the app fails or experiences a problem during checkout. This is a fallback option, and in most cases you would want to allow the customer to complete the checkout, which is the default option. You’ll find two options:

* **Allow customer to complete checkout** : This ensures that even if the app encounters an issue, the customer can still proceed with their purchase without interruption.

* **Block customer from completing checkout**: This will stop the customer from checking out if the app fails, potentially preventing transactions.

Choose the option that aligns best with your desired customer experience and risk tolerance.

<img src="https://mintcdn.com/storespark/lkY0mx0uZwe--5lB/images/concepts/fallback.webp?fit=max&auto=format&n=lkY0mx0uZwe--5lB&q=85&s=b5710aea78ae7167cebea8308f751d26" alt="Fallback" width="959" height="133" data-path="images/concepts/fallback.webp" />

Finally, click the <b>Save</b> button at the top to create and save your rule.

<img src="https://mintcdn.com/storespark/ZoBcc0QT_aT_tX8T/images/shared/save-rule.webp?fit=max&auto=format&n=ZoBcc0QT_aT_tX8T&q=85&s=49b09a4f049059fd67144f92d10233ca" alt="Rule Save" width="713" height="184" data-path="images/shared/save-rule.webp" />

## Test the rule

Since, the rule is set to testing status, we have to use `test@testing.com` as the email, instead of the actual email, to run the rule at checkout.

<Warning>
  The image below shows the checkout page <b>before</b> the testing email
  address was used. Please note the error message is not yet displayed.
</Warning>

<img src="https://mintcdn.com/storespark/ZoBcc0QT_aT_tX8T/images/essentials/validation/before-rule-apply-validation-block-rule.webp?fit=max&auto=format&n=ZoBcc0QT_aT_tX8T&q=85&s=48dbdacb87ae89fd9cb17557421194b0" alt="Before Rule Apply" width="915" height="748" data-path="images/essentials/validation/before-rule-apply-validation-block-rule.webp" />

<Note>
  Please ensure to fill out all the required fields in the shipping address.
  Shopify will only run the rule if all the required fields are filled out and
  the customer is actually ready to checkout, to prevent running the rule on
  every keystroke.
</Note>

After leaving the Address line 2 (Apartment, suite, etc) field **empty**, the checkout rule runs and blocks the checkout process. We can verify that the error message **"Enter complete address"** is displayed under the **Address line 2** field at the checkout, as shown below.

<img src="https://mintcdn.com/storespark/ZoBcc0QT_aT_tX8T/images/essentials/validation/after-rule-apply-validation-block-rule.webp?fit=max&auto=format&n=ZoBcc0QT_aT_tX8T&q=85&s=8d9122a3a86e43e0d4e42f03625891a2" alt="After Rule Apply" width="876" height="745" data-path="images/essentials/validation/after-rule-apply-validation-block-rule.webp" />

## Activate the rule

Once testing is done, we can activate the rule, so it can start making changes to the checkout for actual customers. Only activated rules can make changes to the checkout for all customers.

Click on **Rules** in the sidebar to view all rules. Select the rule you want to activate, then click the **Activate** button to activate it.

<Warning>
  Rule activation is only available on paid plans. If you haven't upgraded your
  plan yet, follow the instructions
  [here](/guides/en/get-started/installation#upgrade-your-plan) to upgrade.
</Warning>

<img src="https://mintcdn.com/storespark/ZoBcc0QT_aT_tX8T/images/essentials/validation/activate-the-rule-validation-block-rule.webp?fit=max&auto=format&n=ZoBcc0QT_aT_tX8T&q=85&s=26ee5c8023c4ac2f4865b2981653a16f" alt="Activate The Rule" width="970" height="165" data-path="images/essentials/validation/activate-the-rule-validation-block-rule.webp" />
