Search code examples
phpshopware6

Shopware 6: Promotion validation fails if another promotion is present at the same time


The goal is to have two promotions:

  1. Promotion without a code => gives a 3% discount if the selected Payment Method is "Invoice/Vorkasse".
  2. Second promotion is with a code, absolute 10€ discount, with two rules: a) total value of the cart is bigger than 49,99 € b) at least one product in the cart is not discounted product (with the list price).

Additional explanation: That means that the promotion should be valid if at least one product in the cart is not discounted product, and total value of the cart is bigger than 49,99€. In that case, a fixed absolute 10€ discount is added. Promotion should be invalid if all products in the cart are discounted products (with the list price) or if total value of the cart is less than 49,99 €.

What have I done so far: I have created a promotion that works correctly (second promotion with a code) by itself, but if I log in as a customer with selected 'Invoice' as a payment method, the first promotion is applied directly, and from that point, validation seems to fail, and second promotion becomes valid if code is entered.

How to replicate the behavior:

  1. Clean Shopware environment and add list price to one product
  2. Create two rules in Rule Builder: a) Invoice 3% => Applied payment method > is one of > Invoice b) Min. 49.99 & without disc.: - Total > is greater than > 49.99 - Item with price/list price percentage ratio > At least one > is empty
  3. Create two new Promotions a) Invoice 3%: - General => active, no code - Conditions => Sales Channels: Storefront, Shopping cart rules: Invoice 3% - Discounts => Apply to cart, percentage, 3 b) 10 Discount - General => Max. uses per customer: 1, active, fixed promotion code: test10 - Conditions => Sales Channels: Storefront, Shopping cart rules: Min. 49.99 & without disc - Discounts => Apply to cart, Absolute, 10
  4. Add discounted product to the cart (with list price)
  5. Add code

Question: I was unable to find where the validation could possibly fail if another promotion is present. Can anyone help me and point me to where the bug could be?


Solution

  • I was able to reproduce the issue. I was able to narrow the cause down to the list price condition. The percentual promotion adds a discount line item with the negative amount. Currently the condition for the list price checks all line items, including discounts, for their list price. A discount, not being a product, has no list price. Hence why the condition is met and the second promotion can be applied. This will be fixed with the upcoming major release 6.5 where conditions obviously meant to only regard products, will no longer match discount line items.

    In the meantime you can use a filter condition to check that there is at least one actual product in the cart, that has no list price. When you choose the condition for total quantity of products there's a filter icon on the right. Click it and a modal will open. Within the modal then add the condition for the list price.

    enter image description here enter image description here