Get Free Audit

Creating a Shipping Module for Magento 2

Feb 21, 2017

1560 Aleksander Kutseika

Creating a Shipping Module for Magento 2

In this new article I’m going to show you how to create a custom shipping module for Magento 2 platform. Here below you can see the structure of the module:

Creating a Shipping Module for Magento 2

1. At first let’s register our module in the system. In order to get that done we should create the following files:

app/code/BelVG/NewShipping/etc/module.xml


and app/code/BelVG/NewShipping/registration.php


magento custom development

Magento Custom Development

Take your online store to the next level with BelVG Magento Custom Development

Visit the page

2. We should provide an ability for users to configure the new shipping method. That’s why we must create new fields in admin panel (Stores->Configuration->Sales->Shipping Methods). And that is what will help us:

app/code/BelVG/NewShipping/etc/adminhtml/system.php


3. Here we create configuration file of our new module:

app/code/BelVG/NewShipping/etc/config.php


4. The next step is creating a model of shipping method, where we can describe the logical circuitry of app/code/BelVG/NewShipping/Model/Carrier/Shipping.php. And here it is necessary to implement these two methods: collectRates and getAllowedMethods.

Andrey_Dubina
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey


Magento store.belvg.com

Magento Extensions

Take your online store to the next level with BelVG Magento extensions

Visit the store

Whereafter we should enable the module by running the following commands:

php bin/magento module:enable -c BelVG_NewShipping

php bin/magento setup:upgrade

And here in admin panel we are able to configure the shipping method:

Stores-> Configuration-> Sales-> Shipping Methods

Creating a Shipping Module for Magento 2

Andrey_Dubina

Partner With Us

Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey

And what concerns the frontend, during the order placement process a user can simply select our new shipping method.

Creating a Shipping Module for Magento 2

Creating a Shipping Module for Magento 2

migration to magento 2

Magento 2 Migration

Take your online store to the next level with BelVG Magento 2 Migration

Visit the page
Andrey Dubina
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Andrey

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *