Add a currency resolver API (with a CurrentCurrency object).

Created on 13 March 2019, over 5 years ago
Updated 13 October 2023, 8 months ago

Commerce has the concept of a current country, locale, store.
It also has price resolvers, which allow selecting a price based on these, or other factors.
What it doesn't have is the concept of a current currency, that could be used by price resolvers.

This would be useful for example in Commerce Pricelist, cause it would allow defining prices per-currency and having them automatically selected. Relevant contrib module: http://drupal.org/project/commerce_currency_resolver

So, the plan is:
- CurrentCurrency and CurrentCurrencyInterface in \Drupal\commerce_price
- CurrencyResolverInterface, ChainCurrencyResolverInterface, ChainCurrencyResolver in \Drupal\commerce_price\Resolver
- StoreCurrencyResolver in \Drupal\commerce_store\Resolver which returns the store currency.

That means no DefaultCurrencyResolver in commerce_price, cause we have nothing to base the decision on, except returning the first alphabetical defined currency, which doesn't feel very useful.

✨ Feature request
Status

Needs work

Version

2.0

Component

Other

Created by

πŸ‡·πŸ‡ΈSerbia bojanz

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024