vendure-ecommerce / vendure

The commerce platform with customization in its DNA.
https://www.vendure.io
Other
5.7k stars 1.01k forks source link

Multi-currency support for promotion conditions & actions #2520

Open StampixSMO opened 11 months ago

StampixSMO commented 11 months ago

Describe the bug When using channels with multi-currency, creating promotions is not very straightforward because only the default currency is supported. This results in potential unexpected discounts, since you can't define a monetary value per currency.

To Reproduce Steps to reproduce the behavior:

  1. Create a new channel with more than 1 currency (and a default one), see my first screenshot
  2. Try to create a promotion with a condition or action that requires a monetary value, see my second screenshot.
  3. It's not possible to define the monetary value in another currency

image image

Expected behavior The promotion condition & action to be multi-currency supportive, i.e. you can enter the monetary value in multiple currencies and the condition/action will act accordingle.

Environment (please complete the following information):

michaelbromley commented 11 months ago

Hi! Have you tried implementing something like this yourself as a custom PromotionAction? I think it should be possible using existing APIs.

StampixSMO commented 11 months ago

I have not tried this yet since we didn't need it just yet, rather I just noticed it wasn't possible.

A custom PromotionAction with a custom input field too then? Which does allow multiple currencies? Since the current one hardcodes the channel's default currency. Doesn't it make more sense to add this to the existing actions?

michaelbromley commented 11 months ago

Yes, it can be added to the default actions, but I suggested it as something you can do if you need support right now and cannot wait for core support. I'm not 100% certain of the best implementation for this, but you could eg define a string list arg which can be used to encode currencyCode/price pairs which are then used by the action to select the correct discount.

StampixSMO commented 11 months ago

Yes, it can be added to the default actions, but I suggested it as something you can do if you need support right now and cannot wait for core support. I'm not 100% certain of the best implementation for this, but you could eg define a string list arg which can be used to encode currencyCode/price pairs which are then used by the action to select the correct discount.

Ah okay, yep that's definitely possible with a custom promotion action as a workaround for the time being. Thanks for the suggestion!