I want to have the "currency source" set to "Price field per currency". My understanding is that I don't need any kind exchange rate process in that case. However, it is a mandatory field and hence I can't submit the form without selecting an option.
Also, the Exchange Rate API field is empty so it is actually not even possible to select a default option to submit the form.

Comments

vbouchet created an issue. See original summary.

vbouchet’s picture

Please find a tentative patch.

It uses the states API to display and make the currency_exchange_rates field required only if currency_source is "auto" or "combo".

I removed the disable for the submit form as it won't submit anyway when the currency_exchange_rates is visible but not filled (as required).

vbouchet’s picture

Status: Active » Needs review
valic’s picture

Status: Needs review » Active

Most of the module relies on having an exchange service.
There are not only prices per product, but also promotions, shipping rates, etc..

You need to have set up at least one exchange rate. This is hard requirement for this module.

Also, if you leave one field empty accidentally, the module still is going to fallback to auto-calculating price.

valic’s picture

Without having set exchange rate service you are going to encounter more errors.

If you don't need exchange service or you think it will not be used anytime, you still can create a manual plugin for exchanger
(there is no need to have 3rd party service)

vbouchet’s picture

Hi Valic, thanks for the quick reply. I understood that a little bit later after the patch as I faced one of the error you probably had in mind. ;-) I am not sure it make sense to have a "field" only option given the code is actually doing the "combo" process whatever.

valic’s picture

Yes, it is a bit redundant. The module does not add the field directly and does not force them to be required.
So decided at one point to set that as a fallback

valic’s picture

There was one specific recent requirement similar to this, link that issue below.

And assigning issue to me. We could maybe do something for version 2.x.
1.x is not getting anymore bigger changes

valic’s picture

Status: Active » Needs work
valic’s picture

Title: Impossible to submit the configuration form without selecting an exchange rate API » Review if the commerce_exchanger should be required by the currency resolver module
Category: Bug report » Task
Priority: Normal » Major

Changing the title to reflect the task better

valic’s picture

Issue tags: +currency-resolver-2
Parent issue: » #3179459: Version 2.x

Let's tackle this for v 2.x

rajivgandhi chinnakrishnan’s picture

We have added the patch in the commerce exchanger module. https://www.drupal.org/project/commerce_exchanger/issues/3177803#comment...

To make that work, the below patch needs to be added in commerce_currency_resolver. Otherwise, we will get the below error,

Fatal error: Class Drupal\commerce_currency_resolver\PriceExchangerCalculator contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Drupal\commerce_exchanger\ExchangerCalculatorInterface::exchangerIsEnabled) in /var/www/html/web/modules/contrib/commerce_currency_resolver/src/PriceExchangerCalculator.php on line 12

valic’s picture

Now with version 2.0 exchanger is not required anymore.

Please refer to the release and change record
https://www.drupal.org/project/commerce_currency_resolver/releases/2.0.0

valic’s picture

Status: Needs work » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.