Something went wrong while saving this configuration: Area is already set
Note : This is a know issue in Magento 2.2.4 (see GitHub issue) and below fix is just a temp fix. You should not directly change the Magento core file (override or create a plugin)
Change in Magento\Email\Model\AbstractTemplate.php
this:
public function setForcedArea($templateId)
{
if ($this->area) {
throw new \LogicException(__('Area is already set'));
}
$this->area = $this->emailConfig->getTemplateArea($templateId);
return $this;
}
For this:
public function setForcedArea($templateId)
{
if (!isset($this->area)) {
$this->area = $this->emailConfig->getTemplateArea($templateId);
}
return $this;
}
It should fix the issue
Update : can also be fixed by applying this Patch
For fixed error Something went wrong while saving this configuration: Area is already set
while saving theme configuration. You want create plugin for override Magento\Email\Model\AbstractTemplate.php
file in custom module. And update setForcedArea()
function.
File path: magento/app/code/Vendor/AreaConfigFix/registration.php
<?php
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Vendor_AreaConfigFix', __DIR__);
File path: magento/app/code/Vendor/AreaConfigFix/etc/module.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_AreaConfigFix" setup_version="1.0.0">
<sequence>
<module name="Magento_Email"/>
</sequence>
</module>
</config>
File path: magento/app/code/Vendor/AreaConfigFix/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Email\Model\AbstractTemplate">
<plugin name="email_setforced_area" type="Vendor\AreaConfigFix\Plugin\Email\Model\AbstractTemplate" />
</type>
</config>
File path: magento/app/code/Vendor/AreaConfigFix/Plugin/Email/Model/AbstractTemplate.php
<?php
namespace Vendor\AreaConfigFix\Plugin\Email\Model;
class AbstractTemplate
{
private $emailConfig;
public function __construct(\Magento\Email\Model\Template\Config $emailConfig)
{
$this->emailConfig = $emailConfig;
}
public function aroundSetForcedArea(\Magento\Email\Model\AbstractTemplate $subject, \Closure $proceed, $templateId)
{
if (!isset($this->area)) {
$this->area = $this->emailConfig->getTemplateArea($templateId);
}
return $this;
}
}