cancel
Showing results for 
Search instead for 
Did you mean: 

Class setAreaCode does not exist

Class setAreaCode does not exist

this code, witch disable of activate tablerate, was working in magento 2.2.7, afther update to 2.3 the code still works in developer mode but afhter di/compile it give me this error : Class setAreaCode does not exist

 

this is the code someone has any idea to resolve this?

		use Magento\Framework\App\Bootstrap;
		require __DIR__ . '/../../../../../app/bootstrap.php';

        $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
        $objectManager = $bootstrap->getObjectManager();
        $objectManager->get(\Magento\Framework\App\State::class)->setAreaCode('adminhtml');
        $objectManager->create('\Magento\Framework\App\Config\Storage\WriterInterface')->save('carriers/tablerate/active',  1, 'default', 0);
        $objectManager->create('\Magento\Framework\App\Config\Storage\WriterInterface')->save('carriers/tablerate/active',  1, 'websites', 1);
1 REPLY 1

Re: Class setAreaCode does not exist

Hi @reneeetje 

 

I suggest you to run these two commands in Magento DB.

 

Before run these command I would recommend to take a database backup.

 

UPDATE flag SET flag_data = NULL WHERE flag_code = 'system_config_snapshot';
UPDATE flag SET flag_data = NULL WHERE flag_code = 'config_hash';

I hope it will help you.

 

Thanks

 

--
If my answer is useful, please Accept as Solution & give Kudos