Magento 2: ERROR – Area is already set

The issue ‘Area is already set’ is the common issue in Magento 2.2.4 and 2.2.5 version and it is the critical issue because we can not change the theme configuration. We also face this issue when upgrading Magento from lower version to upper version.

Merchants are unable to change a store view’s applied theme in Magento. When a merchant tries to change the Applied theme setting for a store view (Content > Design > Configuration), Magento does not change the theme, but instead displays this error: Something went wrong while saving this configuration: Area is already set.

This solution is simple. Go to the module module-email in vendor and open the file AbstractTemplate.php.

vendor/magento/module-email/Model/AbstractTemplate.php

Change script from:


public function setForcedArea($templateId)
{
if ($this->area) {
throw new \LogicException(__('Area is already set'));
}
$this->area = $this->emailConfig->getTemplateArea($templateId);
return $this;
}

to:

public function setForcedArea($templateId)
{
if (!isset($this->area)) {
$this->area = $this->emailConfig->getTemplateArea($templateId);
}
return $this;
}

I concluded that it is better to override this file in your theme so that you will not lose in the next upgrade or after run composer install.

Enjoy!!