Display Rules System
The Display Rules System provides advanced conditional logic for showing or hiding components at checkout based on real-time customer data, cart contents, and checkout context. This powerful feature allows you to create highly targeted, personalized checkout experiences that show the right content to the right customers at the right time.
desc - Advanced conditional logic for showing or hiding components based on customer data and cart contents.
Overview
Display Rules enable sophisticated targeting through conditional logic that evaluates in real-time during checkout. Create complex rules using "all" (AND) or "any" (OR) logic operators, and group multiple conditions together for unlimited flexibility. The system supports nested rule groups, allowing you to combine different logic operators within a single component for precise targeting scenarios.
Rule Types
Cart & Order Rules
Cart Total: Show/hide based on cart subtotal amount (greater than, less than, equal to)
Product in Cart: Target based on specific products, collections, or product types in cart
Cart Attributes: Use custom cart attributes set via your storefront
Line Item Properties: Target based on line item property data
Discount Codes: Show/hide when specific discount codes are applied
Order Count: Target based on customer's previous order history
Customer Rules
Customer Country: Target specific countries or regions
Customer Tags: Show to customers with specific tags
Customer Email: Target specific email addresses or domains
Customer Type: Differentiate between new and returning customers
Checkout Context Rules
Shipping Method: Show/hide based on selected shipping method
Payment Method: Target based on payment method selection
Market: Show to customers in specific Shopify Markets
Language: Target based on customer's checkout language
Product & Collection Rules
Specific Products: Target when specific product IDs are in cart
Product Collections: Target when products from specific collections are present
Product Type: Target based on product type (Apparel, Electronics, etc.)
Product Vendor: Target based on product vendor
Product Tags: Target when products with specific tags are in cart
Advanced Rules
Date & Time: Show during specific date ranges or times
Device Type: Target mobile vs desktop shoppers
Cart Item Count: Show/hide based on number of items in cart
Logic Operators
ALL (AND Logic)
Requires ALL conditions in the group to be true. Use when you need multiple criteria met simultaneously.
Example: Show warranty upsell when cart total > $500 AND customer country is United States AND product type is Electronics
ANY (OR Logic)
Requires at least ONE condition in the group to be true. Use when any of several criteria should trigger display.
Example: Show gift wrapping option when product collection is "Gifts" OR product tag is "giftable" OR cart attributes include "is_gift"
Nested Rule Groups
Nested groups allow you to combine AND and OR logic for complex scenarios. You can create groups within groups with different logic operators.
Example Structure:
Show component when:
ALL of the following are true:
- Cart total > $100
- ANY of the following are true:
- Customer country is US
- Customer country is Canada
- ANY of the following are true:
- Product "Premium Widget" is in cart
- Product "Deluxe Widget" is in cart
Combining Display Rules
Best Practices for Complex Rules
1. Start Simple, Add Complexity
Begin with basic rules and test. Add complexity incrementally.
2. Use Nested Groups for Multiple Conditions
When you have multiple "OR" conditions within an "AND" group, use nesting.
3. Test Thoroughly
Test rules with various cart combinations to ensure expected behavior.
4. Consider Performance
While rules are optimized, excessive nesting can impact performance. Keep rules as simple as possible while achieving your goal.
Common Combination Patterns
Pattern 1: Geographic Product Targeting
ALL:
- Customer country is United States
- Product from collection "Electronics" in cart
- Cart total > $200
Use case: Show premium warranty upsell only to US customers buying expensive electronics
Pattern 2: Multi-Market Promotion
ANY:
- Customer in market "United States"
- Customer in market "Canada"
- Customer in market "United Kingdom"
AND ALL:
- Cart total > $150
- Discount code "SUMMER2024" NOT applied
Use case: Show free shipping threshold to specific markets who don't have discount
Pattern 3: Customer Segmentation
ALL:
- Customer has tag "VIP"
- Order count > 5
ANY:
- Cart total > $500
- Product from collection "Premium" in cart
Use case: Show exclusive upsell to repeat VIP customers with high-value carts
Pattern 4: Product Category Targeting
ANY:
- Product with tag "fragile" in cart
- Product type "Glassware" in cart
- Product type "Electronics" in cart
AND ALL:
- Shipping method contains "Standard"
- Customer country in group [US, CA, UK, AU]
Use case: Show insurance/protection upsell for fragile items with standard shipping
Pattern 5: New Customer Welcome
ALL:
- Order count = 0 (new customer)
- Cart total > $75
- Customer email NOT contains "@example.com" (exclude test)
ANY:
- Product from collection "Best Sellers" in cart
- Product from collection "New Arrivals" in cart
Use case: Show loyalty program signup to new customers making substantial first purchase
Pattern 6: Conditional Gift Wrapping
ANY:
- Cart attribute "gift" = "true"
- Product tag "giftable" in cart
- Product from collection "Gifts" in cart
AND ALL:
- Cart total > $25
- Shipping method does NOT contain "Express"
Use case: Offer gift wrapping when order appears to be a gift and shipping allows time
Real-Time Evaluation
All rules evaluate in real-time as customers interact with checkout:
- Cart total rules update when products are added/removed
- Shipping method rules activate when shipping method is selected
- Discount code rules trigger when codes are applied
- Product rules evaluate as cart contents change
Display Rules with Market Targeting
Display Rules work seamlessly with Market Targeting. You can:
- Use Market Targeting to limit components to specific markets
- Use Display Rules within those markets for additional targeting
- Combine both for precise control
Example: Market Targeting limits to "United States", then Display Rules show only when cart total > $100
Tips for Effective Display Rules
1. Prioritize Customer Experience
Don't over-segment. Too many conditional components can make checkout unpredictable.
2. Test Edge Cases
Test what happens when rules conflict or when customers modify carts.
3. Use Preview Mode
Use live preview to simulate different rule conditions during setup.
4. Document Your Logic
For complex rule sets, document your intent for future reference.
5. Monitor Analytics
Use analytics to see which rules are working and which components never display.
6. Start Broad, Then Narrow
Begin with broad rules and narrow based on performance data.
7. Combine with A/B Testing
Use component duplication to test different rule combinations.
Limitations
- Universal Components v3 only
- Rules evaluate client-side in real-time
- Complex nested rules may have minimal performance impact
Technical Notes
- Rules are evaluated client-side for instant response
- Changes to cart/checkout trigger immediate re-evaluation
- No limit on number of rules per component
- Nested groups support unlimited depth (though simpler is better)