Access rules
Custom liquid
Write your own Liquid snippet to decide access, with customer, cart, product, and storefront variables.
The Custom liquid rule lets you write your own Liquid code snippet to decide whether a visitor gets access. It’s the most flexible rule in the app — anything you can express as a Liquid condition against the customer, their cart, the current product or collection, or the storefront itself, you can use to gate content — but it’s also the one rule where a mistake in the snippet has real consequences, covered below.
How it works
Section titled “How it works”Custom liquid is an action-based rule, so it doesn’t have an If/Unless toggle. Instead, the app runs your snippet for each visitor and reads its final result. The result must be exactly true or false (surrounding whitespace is ignored): true passes the rule and false fails it. Other output, such as true - customer is eligible, is not a valid result. Your snippet has access to the same kind of data a Shopify theme would have about the current visitor and page.
Adding the rule
Section titled “Adding the rule”Open the lock, click the Unlock rules tab, and choose Custom liquid from the Condition type dropdown.

Select Custom liquid from the Condition type dropdown on the Unlock rules tab.
The code editor
Section titled “The code editor”The rule’s condition type opens a dedicated Liquid code editor with syntax highlighting, autocomplete, and real-time syntax validation — errors in your Liquid are flagged directly in the editor as you type, before you even save.

Writing and validating a Liquid snippet in the code editor.
Available variables
Section titled “Available variables”The editor exposes a library of variables you can insert, grouped by what they describe:
| Group | Variables |
|---|---|
| Customer | customer, customer.tags, customer.orders_count, customer.total_spent, customer.b2b? |
| Cart | cart.item_count, cart.total_price, cart.items |
| Product & collection | product.tags, product.vendor, product.metafields, collection.handle |
| Storefront | request.path, request.page_type, localization.country.iso_code, localization.language.iso_code |

Browsing the available variables from the Variables and templates panel.
Starter templates
Section titled “Starter templates”If you’d rather start from something working than an empty editor, the same panel includes ready-made templates you can drop in and adjust, including a logged-in customer check, a customer-tag check, a cart quantity or cart total minimum, a product-tag check, a visitor-country check, a URL-path check, and a ready-made Shopify B2B customer template that checks customer.b2b? directly.

Choosing a starter template, including the ready-made Shopify B2B template.
Steps to manage
Section titled “Steps to manage”- Open the lock you want to protect and click the Unlock rules tab.
- Add an access rule and set the condition type to Custom liquid.
- Write your snippet directly in the editor, or open Variables and templates to copy a variable or start from one of the ready-made templates.
- Make sure your snippet’s final output is exactly
truefor visitors who should pass and exactlyfalsefor everyone else. Do not add explanatory text, HTML, or other output around the value. The editor flags basic syntax problems, but you still need to confirm the logic matches what you intend. - Optionally set a per-rule Redirect URL, used only if this specific rule denies the visitor.
- Save the lock.
Fail-open behavior
Section titled “Fail-open behavior”Example: Allow signed-in customers with a VIP tag
Section titled “Example: Allow signed-in customers with a VIP tag”Suppose a private page should only be available to signed-in customers whose account has the vip tag.
- Select the VIP collection preview page as the content to protect.

Pick the page you want to keep for VIP customers.
- Add Custom liquid and replace the starter snippet with:
{% if customer and customer.tags contains 'vip' %}true{% else %}false{% endif %}The editor confirms Liquid syntax is valid underneath as you type.

The editor highlights the Liquid and validates the syntax before you save.
- Leave the rule’s Redirect URL empty.
- Set the Access denied message to:
This page is available to VIP customers only.

Custom liquid has a single message field, shown to everyone the snippet rejects.
- Click Save.
Result on the storefront
Section titled “Result on the storefront”The snippet outputs exactly true for a signed-in customer with the vip tag, so the page opens normally. It outputs exactly false for guests and customers without that tag, so they see the message above. Do not add text before or after true or false in the snippet output.

When the Liquid snippet returns false, the visitor sees the Access denied message from this example.