Best Practices
This page covers practical recommendations for getting the most out of Advance Discount Function. Following these guidelines will help you avoid common pitfalls, keep your discount configurations maintainable, and ensure reliable behavior at checkout.
Naming Conventions
Clear, descriptive names make your discount configurations easier to manage as they grow.
Rule Group Names
Include the key details of the promotion in the rule group name so you can identify it at a glance without opening the configuration:
| Weak Name | Strong Name |
|---|---|
| ”Discount 1" | "VIP 20% Off All Products" |
| "Summer promo" | "Summer Sale — 15% Off Tagged Items" |
| "Free shipping rule" | "Free Shipping US/CA $75+" |
| "BOGO" | "Buy 2 Get 1 Free — Accessories Collection” |
Discount Messages
The message field is displayed to customers at checkout. Keep it concise but informative:
- Include the discount value: “20% OFF” rather than just “Discount applied”
- Reference the promotion name if relevant: “Summer Sale — 20% OFF”
- Avoid internal jargon or rule IDs in customer-facing messages
Rule Group IDs
Use a consistent ID format like rg_001, rg_002, etc. While the ID is not customer-facing, a predictable pattern makes debugging easier when reviewing JSON configurations.
Testing Discounts
Always test your discount configurations before going live. A misconfigured discount can cost you revenue or create a poor customer experience.
Use a Development Store
If you have access to a Shopify development store or a Shopify Partner account, test all new discount configurations there first. This gives you a safe environment where real customers are not affected.
Test These Edge Cases
Before activating a discount in production, verify the following scenarios:
- Empty cart — Does the discount correctly show nothing when no items qualify?
- Partial qualification — If only some items match the conditions, do non-qualifying items remain at full price?
- Threshold boundaries — Test values at, just below, and just above your thresholds. A “cart subtotal >= $100” condition should not fire on a $99.99 cart.
- Multiple rule groups — If you have multiple rule groups, test combinations to confirm the strategy (
first,all) produces the expected result. - Customer segments — Test with different customer tags, order counts, and authentication states to verify condition logic.
- Discount codes — If using code-based discounts, verify the code activates correctly and rejection rules block the right scenarios.
- Gift cards — Confirm that gift card line items are excluded from product-level discounts (they always are, but it is worth verifying your expectations).
Monitor After Launch
After activating a new discount, check the first few orders to confirm the discount applied as expected. Look at the order details in Shopify Admin to verify discount amounts and messages.
Performance
Shopify Functions run in a constrained WebAssembly environment. While Advance Discount Function handles the execution for you, your configuration choices affect how efficiently the function runs.
Keep Rule Groups Focused
Each rule group adds evaluation overhead. Rather than creating many small, overlapping rule groups, consolidate related logic where possible. For example, instead of creating separate rule groups for “10% off Product A” and “10% off Product B”, create one rule group with a product-level condition that matches both products.
Use the “First” Strategy When Possible
The "first" strategy stops evaluating rule groups as soon as one matches. If your rule groups represent a priority order (e.g., VIP discount first, general discount second), "first" is more efficient than "all" because it avoids unnecessary evaluation of lower-priority groups.
Limit the Number of Conditions
While you can add up to 18 condition types to a single rule group, each condition requires evaluation. Use only the conditions you genuinely need. A rule group with 2 well-chosen conditions is better than one with 8 conditions that include redundant checks.
Choosing the Right Function Type
Selecting the correct function type is the most important decision you make when creating a discount. Use this decision tree:
Simple If-Then Discount
Use: Conditional Discount
If your logic follows the pattern “if these conditions are true, apply this discount”, the Conditional function is the right choice. It supports all 18 conditions, all 3 discount classes (product, order, shipping), and is available on the Starter plan.
Examples: percentage off tagged products, free shipping over a threshold, discount for VIP customers.
Volume or Spending Thresholds
Use: Tiered Discount
If the discount value should escalate based on how much the customer buys or spends, use the Tiered function. It evaluates multiple threshold levels and applies the highest qualifying tier.
Examples: buy 3+ items get 10% off / buy 6+ items get 20% off, spend $100 get 5% off / spend $200 get 10% off.
Buy-One-Get-One or Promotional Gifts
Use: Buy X Get Y
If the promotion follows a “buy these items, get those items discounted” pattern, use the BXGY function. It handles the allocation logic (which items are bought, which are gotten) automatically.
Examples: buy 2 get 1 free, buy a main course get a dessert 50% off.
Product Combination Bundles
Use: Bundle Discount
If the discount should only apply when the customer has a specific combination of products in their cart, use the Bundle function. It validates that all required components are present before applying the discount.
Examples: buy a phone case + screen protector + charger for 20% off, complete skincare routine bundle.
Condition Ordering
When using AND logic, conditions are evaluated in the order they appear in the conditions array. While the end result is the same regardless of order (all must pass), ordering can affect evaluation efficiency.
Put the most restrictive conditions first. If a condition is likely to fail for most carts, placing it first means the function can skip the remaining conditions sooner.
For example, if you are targeting VIP customers who spend over $100:
{
"conditionLogic": "and",
"conditions": [
{
"type": "customerTag",
"operator": "hasAny",
"tags": ["VIP"]
},
{
"type": "cartSubtotal",
"operator": "greaterThanOrEqual",
"value": 100
}
]
}
The customerTag condition is more restrictive (fewer customers are VIPs than have carts over $100), so it is placed first. If the customer is not a VIP, the function skips the subtotal check entirely.
Strategy Selection
The strategy field controls how the function handles multiple matching rule groups. Choosing the right strategy is critical to getting the expected discount behavior.
Use “First” for Priority-Based Rules
When your rule groups represent a priority order — where the first matching group should “win” and prevent lower-priority groups from applying — use "first".
Common pattern: A VIP discount (30% off) followed by a general discount (10% off). With "first", VIP customers get 30% off and evaluation stops. Non-VIP customers skip the first group and get 10% off from the second.
Use “All” for Stacking Discounts
When your rule groups are independent and should combine, use "all". Every matching group’s discount is applied.
Common pattern: A product category discount (15% off electronics) plus a loyalty discount (5% off for returning customers). With "all", a returning customer buying electronics gets both discounts.
Important: When using "all", be aware that multiple discounts stacking can produce larger-than-expected total discounts. Test thoroughly to ensure the combined result is within your acceptable range.
Discount Code vs. Automatic
Shopify supports two discount activation methods: automatic discounts and discount codes. Each has distinct advantages.
Use Automatic Discounts When:
- The promotion should be visible and available to all customers without any action on their part.
- You want maximum uptake (e.g., site-wide sales, seasonal promotions).
- The discount is always-on for a customer segment (e.g., VIP pricing, staff discounts).
- You want to reduce checkout friction by not requiring code entry.
Use Discount Codes When:
- The promotion is targeted at a specific audience who receives the code (e.g., email subscribers, social media followers).
- You want to track which marketing channel drove the conversion.
- The discount is exclusive and should not be discoverable by browsing the site.
- You need to limit redemptions by distributing a finite number of codes.
Combining Both
You can have automatic discounts and code-based discounts running simultaneously across different discount functions. Shopify’s combinesWith settings control whether they can stack. See Managing Multiple Discounts below for details.
Managing Multiple Discounts
When you have multiple discount functions active simultaneously, Shopify’s combinesWith settings determine which discounts can coexist on a single order.
How combinesWith Works
Each discount you create in Shopify Admin has three combinesWith toggles:
| Toggle | Description |
|---|---|
| combinesWith.productDiscounts | This discount can stack with other product-class discounts. |
| combinesWith.orderDiscounts | This discount can stack with other order-class discounts. |
| combinesWith.shippingDiscounts | This discount can stack with shipping-class discounts. |
These settings are configured at the Shopify discount level (outside of Advance Discount Function’s rule builder). They control cross-function stacking — whether discounts from different functions or different Shopify discounts can apply together.
Recommendations
- Enable shipping combinations broadly. Most merchants want shipping discounts to stack with product or order discounts. A customer should get both “20% off products” and “free shipping” if they qualify for both.
- Be selective with product + order combinations. Allowing both a product discount and an order discount to apply simultaneously can result in deeper-than-intended savings. Test the combined outcome before enabling.
- Use rejection rules for mutual exclusivity. If you need one discount to block another within the same function, use rejection rules rather than relying solely on
combinesWith. Rejection rules give you condition-based control over code blocking.
Summary
| Practice | Recommendation |
|---|---|
| Naming | Use descriptive names with discount details |
| Testing | Test edge cases on a development store first |
| Performance | Keep rule groups focused; prefer “first” strategy |
| Function type | Match the function to the discount pattern |
| Condition order | Most restrictive conditions first |
| Strategy | ”First” for priority, “All” for stacking |
| Activation | Automatic for broad promotions, codes for targeted ones |
| Multi-discount | Use combinesWith and rejection rules for cross-function control |
Next Steps
- Real-World Examples — See complete configurations for common discount scenarios.
- Migration Guide — Migrate from Shopify Scripts or native Shopify discounts.
- Troubleshooting — Diagnose and fix common discount issues.