- Issue created by @jsacksick
- Status changed to Needs review
almost 2 years ago 10:43am 8 February 2023 - 🇮🇱Israel jsacksick
Patch needs test, but attached a first stab at this.
- 🇺🇸United States lisastreeter
This is great! Thank you. We are using a custom
PromotionStorage
class to override theloadAvailable
method to sort promotions by value to the customer.The approach here will work perfectly for us--we can use the same code in an event subscriber instead of the custom class.
- 🇳🇴Norway zaporylie
This will work great for some simple scenarios where promotions can be universally sorted, ie. Promotion A has a better value than Promotion B so it should apply first.
Example:
Merchant has Promotion A with the amount-based offer of 30 USD and Promotion B with the amount-based offer of 50 USD. Given both promotions apply to the Order and both have the compatibility set to none one can decide whether to apply Promotion A OR Promotion B by sorting them accordingly, ex. by the amount value.I think this case alone makes it a good API addition.
My case however is slightly more complex.
Example:
Merchant has Promotion A with the amount-based offer of 30 USD and Promotion B with the percentage-based offer of 30%. Given both promotions apply to the Order and both have the compatibility set to none one should be able to determine which promotion gives a better value to the customer in the context of order item. Therefore if the Unit Price of the Order Item is lower than 100 USD Promotion A gives a better value, but if the Unit Price of the Order Item is greater than 100 USD then Promotion B gives a better value to the customer. When the Unit Price is equal to 100 USD the discount value is equal for Promotion A and Promotion B therefore one with the lower weight applies.This example can get more complex by utilizing Combination Offers plugin.
As I said earlier I think this addition makes sense and is in line with how it is done in the Commerce Shipping module (as already mentioned in the issue summary) but at the same time I hope we can find a way where one can sort Promotions by their value in the context of Order Item
-
jsacksick →
committed a1db0a2d on 8.x-2.x
Issue #3340212 by jsacksick: Introduce a new event for filtering the...
-
jsacksick →
committed a1db0a2d on 8.x-2.x
- Status changed to Fixed
over 1 year ago 11:21am 3 March 2023 - 🇮🇱Israel jsacksick
Committed the patch from #6, thanks for your feedbacks!
-
jsacksick →
committed e366cde8 on 3.0.x
Issue #3340212 by jsacksick: Introduce a new event for filtering the...
-
jsacksick →
committed e366cde8 on 3.0.x
Automatically closed - issue fixed for 2 weeks with no activity.