Skip to content

Currency rates not updated by crontab #18580

Closed
@jcourtei

Description

@jcourtei

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); }

Metadata

Metadata

Assignees

Labels

Component: CronComponent: DirectoryFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions