Open
Description
Is your feature request related to a problem? Please describe.
I have written a number of promotion conditions and actions. In our case, most conditions and actions apply at the orderLine level, since we work with subscriptions, which is less common in the Vendure space. We also distinguish between "pay now" values, such as downpayments and future payments. As such you run into a lot of limitations.
onActivate
/onDeactivate
do not get state passed down to them.onActivate
/onDeactivate
execute at the order level, even if the action is aPromotionItemAction
- Reading data from Conditions requires explicit condition dependencies. This is extremely limiting
Describe the solution you'd like
onActivate
/onDeactivate
get the same state that is available in theexecute
functiononActivate
/onDeactivate
execute at orderLine level, if the action is aPromotionItemAction
- There should be a standard mechanism for arbitrary reading from conditions based on condition
code
. I would suggest that an object is available at the action level, which can contain the conditionkey
s based on what is returned from a condition. If thekey
is available, it contains an extensible object with a fixed key:orderLineIds
, which represents the orderLineIds that match the condition. I'm not sure if it makes sense to also simply pass a true/false outcome for the used conditions if there is no object returned from it. It might be helpful additional info.
Describe alternatives you've considered
We've written a workaround by passing down resulting orderLineIds
on the ctx
object so we can read them in the onActivate
method.
Additional context
Add any other context or screenshots about the feature request here.
Metadata
Assignees
Type
Projects
Status
👀 Under consideration