Shopware 6 Rule Builder: restricting a rule to checkout-time evaluation without affecting catalog visibility
0 reputation · 07 Aug 2020, 14:48 UTC
0 reputation · 07 Aug 2020, 14:48 UTC
On Shopware 6, I want to use a single Rule Builder rule (for example, cart value above a threshold combined with a customer group) to control shipping and payment method availability at checkout, while making sure the same rule does not implicitly change what anonymous visitors can see in the catalog.
Rules are shared entities reused across shipping, payment, promotions, and advanced pricing, and they are evaluated against the current SalesChannelContext. That means one edit can affect several storefront behaviors at once, and results can differ per sales channel or login state. What is unclear to me is where the evaluation boundary actually lies: Rule Builder appears to gate prices and checkout options, but it does not seem to hide products or prices pre-login on its own.
Assume a recent Shopware 6 minor version; condition types and operators may vary by version, so answers should note version assumptions.
30275 reputation · 07 Aug 2020, 20:21 UTC
To restrict a rule to checkout-time evaluation without affecting catalog visibility, you must ensure the rule is assigned only to checkout-specific entities (Shipping Methods, Payment Methods, or Promotions) and is not linked to any Dynamic Product Groups used in categories or visibility settings.
In Shopware 6 (assuming v6.5+), the Rule Builder does not have a global "scope" toggle. Instead, the scope is determined by the entity that references the rule. Rules are evaluated against the SalesChannelContext, but the trigger for that evaluation depends on the assignment:
Because your goal is to control shipping and payment availability, assigning the rule exclusively to those two entities will naturally isolate it from the catalog rendering process.
Cart amount > X AND Customer group = Y).If you need to hide prices or products based on complex logic that the Rule Builder cannot handle without affecting the catalog, you must move beyond the administration panel. The recommended integration point is decorating the ProductListingRoute or implementing a ProductListingCollectFilterEvent listener. This allows you to inject custom filtering logic into the search and listing queries before they are executed.
Shopware's administration does not provide a native "Where Used" list for rules. To reliably list every entity referencing a specific rule, you must query the database. Replace {rule_id} with the UUID of your rule:
SELECT 'shipping_method' as entity, id FROM shipping_method WHERE availability_rule_id = '{rule_id}';
SELECT 'payment_method' as entity, id FROM payment_method WHERE availability_rule_id = '{rule_id}';
SELECT 'promotion' as entity, id FROM promotion WHERE rule_id = '{rule_id}';
SELECT 'dynamic_product_group' as entity, id FROM dynamic_product_group WHERE rule_id = '{rule_id}';
Diagnostic Detail: Are you using any third-party plugins that extend the Rule Builder to modify product prices (Advanced Pricing) based on these rules? If so, those plugins may trigger evaluation during catalog rendering regardless of the entity assignment.
Use comments to ask for clarification. Post a solution as an answer.
30,275 reputation · 07 Aug 2020, 20:23 UTC
When you want a Rule Builder rule to influence only shipping and payment availability, the rule must be assigned exclusively to those entities; the Rule Builder itself has no global “checkout‑only” switch.
For shipping and payment methods the rule is evaluated each time the system builds the list of available methods, which happens during the cart‑to‑checkout step. It is never run while rendering a category or product detail page unless the same rule is also used in a Dynamic Product Group or a product visibility rule.
Therefore, to keep catalog visibility unchanged, simply verify that the rule is not selected in any DPG, category rule, or product stream condition. No extra event condition is needed for shipping/payment assignments.