cancel
Showing results for 
Search instead for 
Did you mean: 

The exception area code is not set

The exception area code is not set

Hi, I am writing a CLi import tool for a client. The initial import was fine, however now, when I try to update existing products, or add new ones, I get the Area code is not set exception.

 

I have injected Magento\Framework\App\State in to my  constructor, and I'm setting the area code in the execute function with $this->state->setAreaCode('adminhtml'); I can get the products from the collection however when I save the problem. the exception occurs. 

I try to set the state again, but as expected, I get the Area code already set exception.

 

any suggestions would be appreciated.

1 REPLY

Re: The exception area code is not set

Hi @mih_chau,

 

It will be useful to see the code but did you checked this library https://github.com/firegento/FireGento_FastSimpleImport2 ?

 

 

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"