Cart and checkout validation: what it can block and where the message shows

Updated · SMART Functions Creator (E-TRADE PARTNER)

When a validation rule matches, Shopify blocks the entire checkout and shows your message; the customer cannot continue or pay until the violation is resolved. Validations run on cart interaction (off by default), checkout interaction, and checkout completion. They cannot remove single items, reject a discount, or stop quantity changes inside a cart drawer.

SMART Functions Creator builds this as a Shopify Function, with rules or in JavaScript.

Start free trial
On this page
  1. Where and when
  2. Common rules
  3. What the visual builder cannot do

Where and when

  • Run points: Cart interaction (off by default), Checkout interaction, Checkout completion. Enable Cart interaction if you want the error before the customer reaches checkout; whether a theme's cart drawer surfaces it depends on the theme, not on the app.
  • Error placement: the cart as a whole, the email or phone, a delivery address field (Address 1, Address 2, City, Company, Country code, First name, Last name, Phone (delivery), Province code, ZIP), or PO number (B2B). The app does not inject errors into theme components.
  • Failure handling: Block checkout on failure blocks checkout if the function itself fails to run, for example on a timeout, instead of continuing without the validation. It is off by default and can be changed after creation. Rule violations always block checkout.
  • The message text is yours. Translation of the message per language is a common request; ask support about the current options.

Common rules

  • Minimum or maximum quantity: Line group quantity condition. For a per-product cap, create one Line group per product; a collection or tag group sums all matching items.
  • Quantity multiples (12, 24, 36): a multiple-of operator on the Line group quantity.
  • Mixed carts: block when a restricted group has quantity above 0 and any other group also has quantity above 0.
  • Tag-restricted products: block when restricted products are present and the customer lacks the required tag.
  • PO box addresses: use the P.O. box address condition (Extended address input) or match the shipping address line. A validation is the reliable place for this, because Shopify's native rates often omit the address data that delivery customizations would need.
  • Address checks: address conditions include Address line 1, Address line 2, both combined, City, State/province, Postal code, Country, and Shipping address is empty or is not empty. Put the error on the field the customer must fix.
  • B2B orders without a PO number: Buyer is a B2B company plus PO number is empty, with the error on PO number (B2B). The template "Require a PO number for B2B orders" builds it.
  • Weight: for a maximum weight, "is greater than" allows a cart exactly at the threshold; use "greater than or equal" to block the threshold weight too.

What the visual builder cannot do

Comparisons are direct. Compare line groups checks total, subtotal, quantity, or weight of one group against another, but it cannot multiply by a percentage, add a fixed amount, divide, or round. A rule such as "fee quantity must equal round(12.90 + 10% of subtotal)" is not enforceable in the builder; it can be written in the script editor, which also has templates for per-product quantity limits and case packs. Validation cannot depend on the selected payment method.

Related articles