Preconditions and environment
- 2.4.8-p5
- This was working fine on magento 2.4.6-p15
- Issue seems to only occur when the global currency differs from the storeview specific one.
- Can be worked around by setting the global config to allow all Currencies, your Storeviews allow.
Steps to reproduce
- Create a second website, store and storeview.
- Change
currency/options/allow, currency/options/base and currency/options/default to a value different from the global scope for this new website, e.g. NOK.
- Send any graphql request to the server with a
Store header = [your new storeview storecode] and Content-Currency header = NOK.
query productDetail{
productDetail: products(filter: {url_key: {eq: "randomstring"}}) {
items {
sku
__typename
categories {
name
path
url_key
}
}
}
}
Expected result
Expected result is an empty product collection as no product with this url exists.
{
"data": {
"productDetail": {
"items": []
}
}
}
Actual result
Actual result is an error that the currency send as a header is not allowed.
{
"errors": [
{
"message": "Please correct the target currency",
"extensions": {
"category": "graphql-input"
}
}
]
}
Additional information
After some debugging I concluded that the Magento\DirectoryGraphQl\Controller\HttpRequestValidator\CurrencyValidator class is validating the Content-Currency header against both the global scope and the storeview scope. So the core issue seems to be that the Store header is not applied early enough for the Content-Currency to be properly validated.
Release note
No response
Triage and priority
Preconditions and environment
Steps to reproduce
currency/options/allow,currency/options/baseandcurrency/options/defaultto a value different from the global scope for this new website, e.g.NOK.Storeheader = [your new storeview storecode] andContent-Currencyheader = NOK.Expected result
Expected result is an empty product collection as no product with this url exists.
Actual result
Actual result is an error that the currency send as a header is not allowed.
Additional information
After some debugging I concluded that the
Magento\DirectoryGraphQl\Controller\HttpRequestValidator\CurrencyValidatorclass is validating the Content-Currency header against both the global scope and the storeview scope. So the core issue seems to be that the Store header is not applied early enough for the Content-Currency to be properly validated.Release note
No response
Triage and priority