Create a new shipping method in magento 2

In this post I will demonstrate how to create Magento 2 module with a shipping method. Creating shipping method is pretty easy, so let’s go with an example.

1 shipping method should be defined in file config.xml
2 The main node in xml is “default”
3 the same name as property $_code in shipping class app/code/local/Name space]/[Your Module]/Model/Carrier/NewShipping“.
4 Every shipping method should have config options in admin that can add shipping method options through app/code/local/Name space]/[Your Module]/etc/adminhtml/system.xml file
5 Create class app/code/local/Name space]/[Your Module]/Model/Carrier/NewShipping
6 *you might fetch shipping price from different sources over some APIs, you used price from config.xml – xml node price*/
  • First of all, shipping method should be defined in file config.xml. The main node in xml is “default” and child of node “carriers” should have the same name as property $_code in shipping class “app/code/local/Name space]/[Your Module]/Model/Carrier/NewShipping“.

  • Every shipping method should have config options in admin that can add shipping method options through app/code/local/Name space]/[Your Module]/etc/adminhtml/system.xml file

  • Create class app/code/local/Name space]/[Your Module]/Model/Carrier/NewShipping

 

We also contribute great content of Magento Tutorial for Magento 1.x.

DON'T MISS THE CHANCE!

magento tutorial

Magento 2 Shipping Methods Configuration
Change PDF Invoice Logo, Shipment Logo in Magento 2

Leave a Reply

Your email address will not be published. Required fields are marked *