Block checkout with a custom error message
In short
Create a rule under Rules, add the conditions that should stop the order, and add a Show Error Message action with your message and a Position. Set the rule to Active and save. The Rules Executor block must be in your checkout and allowed to block checkout progress.
✓ Applies to
- Deluxe plan only (checkout rules aren't included in Advanced)
- Shopify Plus checkout, with the Rules Executor block added
- Any condition in the rule builder, such as cart total, products, shipping country or address fields
✕ Doesn't apply to
- Warnings that let the buyer continue. This action always blocks
- The thank-you and order status pages
Before you start
- Add the Rules Executor app block to your checkout and allow it to block checkout progress. How to add it.
- Know the condition you want to stop. For example, a shipping country you can’t ship to, a product that can’t ship with another, or a cart below a minimum total. Every condition.
Steps
- In Checkout Ninja, open Rules and click New checkout rule (or Create a checkout rule if you have none yet).
- Enter a Title, up to 30 characters. Buyers never see it.
- Under Condition, click Add condition and set up the first condition. Add more if you need them.
- Set Condition Match Type:
- Only apply when All Conditions Pass to block only when every condition matches;
- Only apply when Any Condition Passes to block when at least one matches.
- Under Action, click Add Action and choose Show Error Message.
- Choose a Position for the message. Use Top of the checkout unless the error is about one field.
- Write the Message. Tell the buyer what to change, for example “We can’t deliver to PO boxes. Please enter a street address.”
- Set Status to Active.
- Click Save.
A rule with no conditions always applies, so a Show Error Message rule without conditions blocks every checkout. Add at least one condition before you set it to Active.
Example: block PO box addresses
- Condition: Shipping Address 1, operator Match regex ( Regular Expression), value
[Pp]\.?\s*[Oo]\.?\s*[Bb][Oo][Xx]. This catchesPO Box,P.O. Boxandpo box. The Contains operator is case-sensitive, soPO Boxwouldn’t matchpo box. - Action: Show Error Message, Position: Shipping Address 1.
Verify it worked
- Open your checkout with a cart and address that match the rule. Try to continue. The message appears in the position you chose, and checkout doesn’t move forward.
- Change the checkout so the rule no longer matches, for example edit the address. Try again. You can now continue.
- Test a checkout that never matched the rule. It goes through with no message.
Limitations
- The block depends on permission. Shopify only lets the Rules Executor stop a buyer if you’ve allowed it to block checkout progress in the checkout editor.
- Shopify Plus only for the information, shipping and payment steps.
- The message is plain text. You can’t add links or formatting.
- The error is tied to the page where the Rules Executor sits. On three-page checkout, a buyer can reach later steps if the executor is only on an earlier one and the condition only starts matching later.
Troubleshooting
Buyers can continue even though the rule matches. The Rules Executor isn’t allowed to block checkout progress, or it isn’t on the page the buyer is on. Step-by-step fix.
The message never appears. Check the rule’s Status is Active, the Rules Executor is in your checkout, and your test checkout really matches the conditions. All versus Any is a common mix-up. Full checklist.
The message doesn’t show next to Email or Phone. Use Top of the checkout instead. The message still blocks the checkout, and the buyer sees it at the top.
Frequently asked
Can I show the error next to a specific field? +
Yes. Position offers Top of the checkout, Shipping Address 1, Shipping Address 2, First Name, Last Name, Email and Phone.
How does the buyer get past the error? +
By changing their checkout so the rule's conditions no longer match, for example entering a different address or removing a product. The rule re-checks every time the checkout changes.
Can I block checkout only for some countries? +
Yes. Add a Shipping Country condition set to Is, list the country codes, and add the Show Error Message action.
Can the message be translated? +
No. The Message field holds one text, and buyers see it exactly as written in every language.