Magento 2 Distance Shipping module helps in calculating the shipping prices based on the distance between the store owner and the customer.
This module allows the admin to set his origin address in the configuration section. Magento 2 Distance Shipping module facilitates the Admin to set distance calculations based on “Google Map Distance Matrix” or “Latitude Longitude”.
Also, the Admin can enable the Estimate shipping feature, which will show a field on the product view page to check the shipping charge.
Features- Magento 2 Distance Based Shipping Calculation
- The Admin can enable/disable the Distance Rate Shipping method for their Products.
- Shipping Origin Address can be set by the Admin, based on which the calculations will be done.
- The Shipping Rates per Unit Distance can be set by the Admin.
- Admin can set to apply the shipping rate item wise.
- The unit distance set by the admin can be in Kilometer or Mile.
- Also, the Admin can add a Handling Charge, Minimum Charge.
- The Maximum area to cover can be set by the Admin.
- Also, the Admin can set Custom Error Message to display if shipping not applicable.
- The admin can enable to Display Estimate Shipping Rate on Product pages.
- Also, the Admin can set distance calculations based on “Google Map Distance Matrix” or “Latitude Longitude”.
Customers will get one zip folder and they have to extract the contents of the zip folder on their system.
Also, the extracted folder will have an src folder, inside the src folder you have the app folder.
Then, You need to transfer this app folder into the Magento2 root directory on the server as shown below.
After the successful installation, you have to run these commands in the Magento2 root directory:
First command –
|1||php bin/magento setup:upgrade|
Second Command –
|2||php bin/magento setup:di:compile|
Third Command –
|3||php bin/magento setup:static-content:deploy|
Hence, after running the commands, you have to flush the cache. This is done from the Magento admin panel by navigating through->System->Cache management as shown below.
Configuration For Multi-lingual Support
For the multilingual support, the admin will navigate through Store->Configuration->General ->Locale Options
Then, the admin can select the locale as German (the language into which admin wants to translate his store content).
If the user wants to translate their module from English to German.
Then, they need to follow the path app/code/Webkul/CRM/i18n in their unzipped Magento 2 CRM folder and will get a CSV file with the name “en_US.csv”.
Now they will rename that CSV as “de_DE.csv” and translate all right side content after the comma in the German language.
After editing the CSV, save it and then upload it to the path app/code/Webkul/CRM/i18n where they have installed Magento2 on the server.
Just enter your email below to subscribe and receive weekly updates about the most interesting similar articles.
Share article viaSignUp Again
The module will get translated into the German Language. It supports both RTL and LTR languages.
Then, the user can edit the CSV file as shown below.
How to Get Google API Key
The admin needs to get the Google Maps API key for address auto-complete to work. Please visit the following link for getting the API Key. Log into your Google account and then click GET A KEY button as visible below:
A pop-up window will appear, Create Project and give any name to it. Then, click ENABLE API.
After a few seconds, the API Key will be generated. Copy the API key, it will be used at the time of module configuration.
After the successful installation, the admin will navigate through Stores-> Configuration-> Distance Rate Shipping to configure the initial module settings.
- Enable: The Admin can select Yes to enable the module.
- Google Map API Key: Enter the above generated Google Maps API Key here.
- The Admin Location: Here, the Admin can enter the location of the store.
- Admin Latitude: The latitude of the admin’s location will be automatically entered once the location is entered.
- Admin Longitude: Also, the longitude will be automatically set according to the entered location.
- Show Estimate on Product Page: If set Yes then this will show the estimate shipping charges on the product page.
- Calculate Distance Based On: The Admin can calculate shipping distance by either selecting “Google Map Distance” or “Latitude and Longitude”
Distance Rate Shipping Configurations
There are a few of the other configurations as well. The admin can configure further configurations by navigating through Stores-> Configuration-> Sales-> Shipping Methods-> Distance Rate Shipping.
- Enabled for Checkout: If set yes then the Distance Rate Shipping will be visible at checkout.
- Title: Enter the Title of the shipping method that will display to the customers on the website front-end.
- Method Name: Also, the method name entered will display to the customers on the website front-end.
- Rate Per Unit: Enter the shipping charges applied on the basis of per unit, set. For example, if the rate per unit is set 50 and the unit set is kilometers and if any customer orders a product within a 1kilometer range then shipping charges will be 50.
- Maximum Area Cover: Here, enter the maximum area to cover for a distance rate shipping.
- Item Wise Rate: If set Yes then the shipping charges will be calculated based on per product. The shipping amount will be multiplied by the number of products ordered.
- Handling Charges: Enter the handling charges.
- Minimum Charge: Set the minimum charge. If shipping charges calculated is less than the minimum charge then minimum charges will be applied.
- Unit: Select the unit that will decide the shipping charges. The Admin can either select “Kilometers” or “Miles”.
- Ship to Applicable Countries: Here, select the countries where distance rate shipping will be applicable. The Admin can either select “All Allowed countries” or “Specific Countries”.
- Ship To Specific Countries: Select the specific countries where this shipping will be applicable. Also, This setting will be available if the admin has selected “specific countries” on “Ship to Applicable countries”.
- Show Method If not Applicable: If yes then the method will show at the front if even if the shipping is not applicable to that area.
- Display Error Message: The entered error message will show when the distance rate shipping is not applicable.
Shipping Charges- Customer View
The customer can check the estimated shipping charges on the product page as shown below:
Also, the customer will enter the location and click on calculate to know the estimate shipping charges.
If the entered location is not available within the maximum coverage area then a message “Shipping is not available in this location” will appear.
After the availability of shipping in the desired location, the customer can Add the product to the Cart and can proceed towards the checkout process.
The customer can also check the estimated shipping charges on the cart page as well.
Now the customer can select the Distance Rate shipping and proceed towards the checkout process
Now the customer can add the shipping address and can select the Distance Rate Shipping.
After selecting the shipping address, the customer can select the payment method, click on “I agree to the terms and conditions” and can place an order.