This example allows only logged-in customers to purchase the eligible items. Use it when you want to sell member-only products and restrict purchases by guests (not logged in).
Prerequisite: The initial setup for Customer limits must be complete. If you haven't done this yet, see "Initial Setup (Customer Limits)".
You can check the behavior after setup in [Demo] Members-Only Sale.
When the customer rule is enabled, it checks the customer's login status whenever the cart contains an eligible item.
Logged-in customers: purchase is allowed.
Guests (not logged in): purchase is not allowed.
(1) Create a customer rule
Open the app admin → "Customer rules" → "Create rule".
(2) Enter the settings
Configure the following.
Field | Value |
|---|---|
Title | Any administrative title |
Customer accounts | "Require account" is checked |
Eligible items | Products where the purchasing customer is restricted |
Product message | Enter if needed |
Display timing | Cart updated and checkout |
Alert message | Enter if needed |
(3) Save and enable the customer rule
After saving the settings, select "Enable." Saving alone does not apply the customer limit.
(4) Check the behavior
Add the eligible item to the cart, and check the result when the cart is updated and at checkout, both while logged out and while logged in.
Even a registered member is treated as a guest while logged out.
To sell only to specific customers, combine this with customer tag or customer metafield conditions.
Variables cannot be used in the product message or alert message for customer rules.