Settings defined in website scopes are ignored
-
05-10-2020 - |
Question
Since one month, I set up a multistore platform under Magento 2. Everything worked perfectly under version 2.1.2 but since I updated it in 2.1.3 two weeks ago I got a big problem :
All settings defined in website scopes are ignored.
For example, if I set a minimal order amount
for one of my websites, I can order normally without any restrictions (not normal). But if I defined this setting in the default scope the restriction work.
Solution
This is a core bug in 2.1.3 - https://github.com/magento/magento2/issues/7943
There is a fix for the issue here - https://github.com/magento/magento2/blob/develop/app/code/Magento/Store/Model/Config/Processor/Fallback.php#L109
To save going to the link, the change you need to make is to vendor/magento/module-store/Model/Config/Processor/Fallback.php
Change this
/**
* Retrieve Website Config
*
* @param array $websites
* @param int $id
* @return array
*/
private function getWebsiteConfig(array $websites, $id)
{
foreach ($this->websiteData as $website) {
if ($website['website_id'] == $id) {
$code = $website['website_id'];
return isset($websites[$code]) ? $websites[$code] : [];
}
}
return [];
}
To
/**
* Retrieve Website Config
*
* @param array $websites
* @param int $id
* @return array
*/
private function getWebsiteConfig(array $websites, $id)
{
foreach ($this->websiteData as $website) {
if ($website['website_id'] == $id) {
$code = $website['code'];
return isset($websites[$code]) ? $websites[$code] : [];
}
}
return [];
}
Note the line
$code = $website['code'];
Ideally you should do this as a patch - see http://jamescowie.me/blog/2016/12/Composer-Magento-Patches/