Magento – How to Find the Shipping Method Code shipping-methods As we have shipping method code for each shipping method. I want to know how to find that shipping method code Best Answer As per as magento system,for a shipping method,it method code is define in it's Shipping method class. In cofig.xml,magento define it model class. Example: <model>shipping/carrier_tablerate</model> On that model class,You can get method name from $_code variable Example: for table rate method: class Mage_Shipping_Model_Carrier_Tablerate extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {.. protected $_code = 'tablerate'; // this method code: .. Related SolutionsTable Rates Shipping Method & Cash on Delivery Payment Code AS i have seen in your reference link you can also see code for 1) table rates shipping method == flatrate_flatrate 2) cash on delivery" payment method. == cashondelivery EDIT class Mage_Shipping_Model_Carrier_Tablerate extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface { /** * code name * * @var string */ protected $_code = 'tablerate'; } Simple Magento shipping method code <pre>Array ( [0] => Array ( [value] => Array ( [0] => Array ( [value] => flatrate_flatrate [label] => Fixed ) ) [label] => Flat Rate ) [1] => Array ( [value] => Array ( [0] => Array ( [value] => freeshipping_freeshipping [label] => Free ) ) [label] => Free Shipping ) [2] => Array ( [value] => Array ( [0] => Array ( [value] => tablerate_bestway [label] => Table Rate ) ) [label] => Best Way ) [3] => Array ( [value] => Array ( ) [label] => Best Way ) ) i am sure it will help you. Magento – Magento 2 Get Shipping Rates of All active shipping methods I just create some code hopefully its help u. create test.php on your project root directory. require __DIR__. '/app/bootstrap.php'; require __DIR__.'/TestApp.php'; $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); $obj = $bootstrap->getObjectManager(); /** @var \Magento\Framework\App\State $state */ $state = $obj->get(\Magento\Framework\App\State::class); $state->setAreaCode('frontend'); /** @var \Magento\Framework\App\Http $app */ $app = $bootstrap->createApplication(TestApp::class); $bootstrap->run($app); Then create TestApp.php on your project root directory. use Magento\Shipping\Model\Config\Source\Allmethods; class TestApp extends \Magento\Framework\App\Http implements \Magento\Framework\AppInterface { public function launch() { /** @var \Magento\Shipping\Model\Config\Source\Allmethods $allmethods */ $allmethods = $this->_objectManager->get(Allmethods::class); echo"<pre>"; print_r($allmethods->toOptionArray()); return $this->_response; } } Related TopicMagento – update shipping address for shipping method change
Best Answer
As per as magento system,for a shipping method,it method code is define in it's Shipping method class.
In
cofig.xml
,magento define itmodel class
.Example:
<model>shipping/carrier_tablerate</model>
On that model class,You can get method name from
$_code
variableExample: for table rate method: