Skip to content

Improvements to Promotions #3348

Open
Open
@mschipperheyn

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.

  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.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      👀 Under consideration

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions