Skip to content

Fix upgrading from 4.x with OrderCurrencyValuesAttributeConditionRule in place #3933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
## Unreleased

- Fixed a PHP error that could occur on Edit Plan pages. ([#3998](https://github.com/craftcms/commerce/issues/3998))
- Fixed a PHP error that could occur when upgrading to Commerce 5. ([#3933](https://github.com/craftcms/commerce/pull/3933))

## 5.3.11 - 2025-05-01

Original file line number Diff line number Diff line change
@@ -65,7 +65,10 @@ public function setCondition(ConditionInterface $condition): void
} else {
/** @var Site|StoreBehavior|null $currentSite */
$currentSite = Craft::$app->getSites()->getCurrentSite();
$this->currency = $currentSite?->getStore()->getCurrency();

if ($currentSite->getBehavior(StoreBehavior::class)) {
$this->currency = $currentSite?->getStore()->getCurrency();
}
}

if ($this->currency) {
@@ -80,7 +83,7 @@ protected function field(): FieldInterface
{
// Mock a Money field
$field = new Money();
$field->currency = $this->currency?->getCode();
$field->currency = $this->currency?->getCode() ?? $field->currency;

return $field;
}