Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to Promotions #3348

Open
mschipperheyn opened this issue Feb 5, 2025 · 1 comment
Open

Improvements to Promotions #3348

mschipperheyn opened this issue Feb 5, 2025 · 1 comment

Comments

@mschipperheyn
Copy link
Collaborator

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.

  1. onActivate/onDeactivate do not get state passed down to them.
  2. onActivate/onDeactivate execute at the order level, even if the action is a PromotionItemAction
  3. Reading data from Conditions requires explicit condition dependencies. This is extremely limiting

Describe the solution you'd like

  1. onActivate/onDeactivate get the same state that is available in the execute function
  2. onActivate/onDeactivate execute at orderLine level, if the action is a PromotionItemAction
  3. 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.

@mschipperheyn
Copy link
Collaborator Author

Another improvement would be dynamic priorityScore calculation using a function that processes the args of a condition or action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant