You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 a PromotionItemAction
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 the execute function
onActivate/onDeactivate execute at orderLine level, if the action is a PromotionItemAction
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 condition keys based on what is returned from a condition. If the key 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.
The text was updated successfully, but these errors were encountered:
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
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
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 thectx
object so we can read them in theonActivate
method.Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: