Choosing Between Rule Builder and Custom Plugin for Dynamic Pricing in Shopware 6.4+
Guide to decide between Shopware Rule Builder and a custom plugin for dynamic pricing, with constraints, a comparison table, trade‑offs, and a step‑by‑step Rule Builder example.
17 Jun 2026, 12:16 UTC

Decision and constraints
You need to apply dynamic discount rules in a Shopware 6.4+ store. The solution must:
- Run on Shopware 6.4 or newer.
- Preserve upgrade safety (no core hacks).
- Keep the rule configurable from the admin UI for non‑developers.
- Add less than 5 ms to each cart calculation.
Option comparison
| Option | Implementation effort | Flexibility | Typical performance impact | Upgrade safety |
|---|---|---|---|---|
| Rule Builder (native) | Low – configure via admin | High – uses predefined conditions/actions | Negligible (<1 ms) when rule count is modest | Safe – part of core, no code to maintain |
| Custom plugin | Medium‑High – write PHP, test, deploy | Full – arbitrary logic, external calls | Variable – depends on plugin efficiency; must be profiled | Requires manual compatibility checks per Shopware version |
Trade‑offs
Rule Builder lets administrators create, edit, or disable discounts without touching code, and the feature is cached safely. Its limitation is the set of built‑in conditions (customer group, cart value, etc.) and actions; you cannot call external APIs or run complex PHP expressions directly.
A custom plugin removes those limits, enabling integration with external pricing services or bespoke mathematical formulas. The cost is development time, testing, and the responsibility to keep the plugin compatible with future Shopware releases.
Concrete implementation – Rule Builder
Follow these steps to create a "VIP 10 % off" discount that applies only to customers in the VIP group.
- Log in to the Shopware admin as a user with the
adminrole. - Navigate to Marketing → Rule Builder.
- Click Create rule.
- Set the rule name to
VIP 10 % off. - Under Conditions, choose Customer group → equals →
VIP(select the group from the dropdown). - Under Actions, choose Discount → Percentage → enter
10. - Save the rule. Note the rule ID shown in the URL (e.g.,
.../rule/42/edit→ ID42). - To verify, create a test customer, assign them to the VIP group, add a product to the cart, and proceed to checkout. The order total should show a 10 % discount line.
- If the discount does not appear immediately, clear the performance cache:
# Run from the shop root directory; requires shell access and file‑system write permissions.
bin/console cache:clear
Risk: clearing the cache temporarily increases response time for the next few requests until caches are rebuilt.
Validation via CLI (optional)
You can test the rule evaluation without placing a storefront order:
# Replace with the ID noted above.
# Provide a JSON context that mimics a cart; adjust as needed.
bin/console sw:rule:evaluate \
--rule-id \
--scope cart \
--context '{"customer":{"groupId":"VIP"}}'
The command returns a JSON result; look for a discount entry with value 0.10 (10 %). If the result is empty, the condition did not match.
Limitations and practical checks
- Rule Builder performance degrades linearly with the number of active rules. Keep the total under ~200 rules to stay comfortably below the 5 ms threshold on typical hardware.
- Complex calculations (e.g., tiered pricing based on weight) cannot be expressed; consider a custom plugin only when such logic is required.
- After any rule change, verify the discount appears in both the Storefront and the admin order view, or run the CLI test above.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.