Description
Preconditions (*)
Version 2.2.6, probably since version 2.2.4 (Community Edition).
Steps to reproduce (*)
Base store has only one allowed currency (EUR). So EUR is the base currency.
French store uses base store values.
English store has 4 allowed currencies (EUR, CAD, USD, GBP).
Crontab configured to update currency rates everyday.
Expected result (*)
Currency rates should be updated everyday.
Actual result (*)
Crontab only updates currency rate EUR to EUR (which is useless).
I found that this issue comes from Magento\Directory\Model\CurrencyConfig which was created in version 2.2.4, in function getConfigCurrencies :
public function getConfigCurrencies(string $path) { $result = $this->appState->getAreaCode() === Area::AREA_ADMINHTML ? $this->getConfigForAllStores($path) : $this->getConfigForCurrentStore($path); sort($result); return array_unique($result); }
Crontab should update currency rates like in admin panel, so the code should be :
public function getConfigCurrencies(string $path) { $result = $this->appState->getAreaCode() === Area::AREA_ADMINHTML || $this->appState->getAreaCode() === Area::AREA_CRONTAB ? $this->getConfigForAllStores($path) : $this->getConfigForCurrentStore($path); sort($result); return array_unique($result); }