How to Add Custom Field to Magento 2 Shipping Method?
Checkout page is arguably the most important page in an e-commerce purchase process. Short and user friendly checkout pages increase conversion rate a great deal. On the other hand, checkout pages that are long and complex often lead to incomplete sales.
Since default Magento 2 offers only standard checkout fields, adding custom fields is important to better understand your customers. Custom details collected at the checkout step can be used to align your marketing strategies. For example, adding ‘How Did You Hear About Us?’ dropdown will let you know which marketing area is working best and which area to focus on. Use the tutorial on how to add custom field to Magento 2 Checkout?
Solution to Add Custom Field to Magento 2 Shipping Method
Here, we are going to discuss how to add custom fields to the shipping method step of the Magento 2 checkout. Magento 2 custom checkout fields extension by FME allows admins to add custom fields to any checkout step. Let’s see how to do this.
- After logging in to the Admin Panel of the extension, click FME Extensions -> Manage Fields
- This page displays all the already added custom checkout fields and their details. You can edit any of the fields by clicking on it. To add a new attribute, click ‘Add New Attribute’.
- The New Attribute Field form allows you to set different attributes for the field. You can write a default label, select field type, make it optional or mandatory,
- Setup input validation
- Restrict it to specific customer groups and store views, and whether to display it in email and PDF etc.
Display Custom Fields in Shipping Method Section of Checkout Page
To display a custom field in the shipping method step;
- Select ‘Shipping Method’ in the ‘Checkout Step’dropdown as shown below.
You can add any of the 9 field types to the shipping method section. The ‘Position’ field is used to make the fields appear before or after the shipping method.