cancel
Showing results for 
Search instead for 
Did you mean: 

disable and enable TabelRate magento shipping

SOLVED

disable and enable TabelRate magento shipping

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?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: disable and enable TabelRate magento shipping

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);
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

View solution in original post

4 REPLIES 4

Re: disable and enable TabelRate magento shipping

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.

 

 

if issue solved,Click Kudos & Accept as Solution

Re: disable and enable TabelRate magento shipping

Thank you but it has to go programaticly and not thru backend. cli or php

Re: disable and enable TabelRate magento shipping

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);
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: disable and enable TabelRate magento shipping

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