I want to enable and disable Table rate shipping in magento 2.3 but it is not a module so thrue cli this wont work, has any one any idee to do this programmatically?
Solved! Go to Solution.
You need to create PHP file in your magento root instance,
Add below code and run file through browser,
<?php require_once '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', 0, 'default', 0); $objectManager->create('\Magento\Framework\App\Config\Storage\WriterInterface')->save('carriers/tablerate/active', 0, 'websites', 1);
Hi @reneeetje
From the magento 2.3 admin panel -> if you go into the store -> configuration -> sales -> Shipping methods -> you will find Table Rates section over here -> First field itself is for Enable/Disable Table Rates shipping methods.
So select No from the dropdown menu and you will able to disable this method from the same.
Hope it helps , let me know if i understand something else or you are referring anything else.
Thank you but it has to go programaticly and not thru backend. cli or php
You need to create PHP file in your magento root instance,
Add below code and run file through browser,
<?php require_once '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', 0, 'default', 0); $objectManager->create('\Magento\Framework\App\Config\Storage\WriterInterface')->save('carriers/tablerate/active', 0, 'websites', 1);
in magento 2.3 it gives me this error when php bin/magento setup:di:compile
[ReflectionException]
Class setAreaCode does not exist
Any idea why