- Issue created by @alexandersluiter
- Merge request !375Issue #3413020 by czigor: Using a translatable string as a category for field... β (Closed) created by alexandersluiter
The Order module's PriceCalculator requires a Context object parameter that is used to prepare dummy orders on the fly in order to apply adjustments. I have a situation where I need to calculate the price of a PurchaseableEntity in two different places, but one of them needs to have it's promotion's filtered using the FilterPromotionsEvent supplied by the Promotions module. This event, or for that matter, any order processor, does not have access to the calculator's Context object. We generally handle this by adding arbitrary data to the Order's data field, and retrieving it in our processors. A simple solution would be to pass a specific data key from the Context object to the dummy order that is generated for price calculation. There is already a provider key hard coded to the Order's data to indicate that the order is being used for price calculation. Adding another key, if available on the Context object, would allow more flexibility for Order Processors on orders used for price calculation.
See Slack Conversation:
https://drupal.slack.com/archives/C1TLCCF9B/p1732227541227889
Active
2.0
Order