Cannot create multiple currencies with the same ISO code for country-specific price factors
- Dominant language
- PHP
- Stars
- 3.4k
- Forks
- 1.2k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 433
Description
### Shopware Version
6.7.14.0
### Affected area / extension
Platform(Default)
### Actual behaviour
Shopware 6 does not allow creating a second currency with an ISO code that already exists.
For example, when creating a currency named "Euro (AT)" with ISO code EUR and a factor of 1.1, saving fails. The Administration only displays a generic error stating that the currency could not be saved.
The underlying database error is:
`SQLSTATE[23000]: Duplicate entry 'EUR' for key 'currency.uniq.currency.iso_code'`
The unique constraint on `currency.iso_code` prevents multiple currency records from using the same ISO code.
Using a custom ISO code such as EUA is not a viable workaround. The currency ISO code is also used for formatting and payment integrations. As a result, the storefront may display EUA 146.00 instead of €146.00, and payment providers may receive an invalid currency code instead of EUR.
This makes it impossible to use Shopware's currency factor to implement different price levels for individual Euro countries while retaining the correct EUR currency code.
### Expected behaviour
Shopware should provide a standard way to apply different price factors to countries or sales channels that use the same currency.
For example, a merchant should be able to configure Austria with a price factor of 1.1 while Germany uses 1.0, with both still using the ISO code EUR.
This could be achieved by either:
allowing multiple currency records with the same ISO code, e.g. "Euro" (EUR) and "Euro (AT)" (EUR), or
providing a price factor directly on sales-channel or country level.
In either case, the actual currency must remain EUR so that the correct currency symbol is rendered on the storefront and documents, and integrations such as PayPal, Stripe, and Amazon Pay receive a valid ISO 4217 currency code.
This is particularly relevant for Eurozone shops that require country-specific price levels. Rule-based advanced prices do not provide an equivalent global price factor for all products.
### How to reproduce
- Go to Settings → Currencies in the Shopware Administration.
- Click Add currency.
- Enter a name such as "Euro (AT)".
- Set the ISO code to EUR.
- Set the factor to 1.1.
- Save the currency.
- Observe that saving fails because another currency with the ISO code EUR already exists.
Contributor guide
Research direction
Start by reproducing the failure through Administration → Settings → Currencies with a second EUR currency and factor 1.1. Review the currency creation flow and the currency.iso_code unique constraint described in the issue, then compare the proposed country or sales-channel factor approaches. Done means country-specific factors work while storefront, document, and payment integrations continue to use EUR.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, databases, payments
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100