Your online shoppers deeply care about shipping costs and delivery options. Because E-commerce model is based on the idea that customers will order products online and then the item is delivered to their location wherever they reside. No matter how good your product is a good shipping system is the backbone of any successful E-commerce business. Having an effective & reliable E-commerce shipping strategy in place is one of the most impactful steps you can take to grow your business online.
By default, Magento 2 offers different shipping methods from which you can enable or disable any shipping method to fulfill your business needs. All the enabled shipping methods will be automatically listed on frontend and your customer will able to pick their convenient shipping method while checkout.
Sometimes it becomes necessary for the store owner to showcase the list of available shipping carriers to build trust among store customers and it can be anywhere. Recently one of customer came across the requirement of where he wants their customers to select their preferred shipping method from available shipping methods while the store registration process.
Here is the code to do the same.
First, we need to create a custom block file with name ‘Shippingmethods.php’ at the following location with below code.
App\code\Vendor\Extension\Block\Shippingmethods.php
Now, you just need to call getActiveShippingMethod() function into your phtml file where you want to display the list of available shipping methods. This function returns the array of active shipping methods and display it.
That’s it! If you found this blog helpful, don’t forget to share it with your colleagues and Magento Friends.
And, Let us know if you are facing an issue while implementing this code.
Happy Listing!