Showing results for 
Search instead for 
Did you mean: 

Adding fields to custom shipping method

Adding fields to custom shipping method



I would like to create a custom shipping module for Magento 2, but I am actually a complete Magento beginner.


I found this GitHub repository which provides a great starting point :


The first thing I need to do is to add some extra fields to the checkout page when my shipping method is selected.


Could help me understand how I should modify the code on this repository in order to add my extra fields (checkboxes, datefields...) ?


I tried to use this :


But I had a Javascript error because of the " %your_module_dir% " part : my module is in MagePsycho/Customshipping/ so I replaced %your_module_dir% with MagePsycho/Customshipping/, but it didn't work.

Moreover I only need my extra field to be visible when my custom shipping method is selected, so I'm not sure this tutorial is appropriate.


Thank you very much !