Overview
Set up live rates at checkout for Magento 2 and display your DHL Express shipping rates to your customers automatically.
About live rates at checkout
The destination address and the total weight of the cart are used to electronically return your DHL Express shipping rate. To take into account dimensions you will need to create custom attribute fields to store this information instructions can be found on Step 5.
Your customer can select the preferred shipping method and the order will be imported with this shipping method.
Rate Disclaimer:
DHL’s Shipment charges are calculated according to the higher of actual or volumetric weight per piece and any piece may be re-weighed and re-measured by DHL to confirm this calculation. This may result in a higher price than displayed at the time of checkout.
-
Prices quoted are estimates based on the information you have supplied.
-
Prices quoted may not include duties, taxes, customs charges or all surcharges and fees.
-
Transit time and price quotes are indicative and DHL has no liability or responsibility for differences between this indicative quote and the actual price or transit time.
-
Your final transit time and price may differ based on the characteristics of the shipment, services requested and the packages actually tendered to DHL.
Plugin Disclaimer:
While every effort has been made to ensure the accompanying plugin is as compatible as possible, many factors such as site customizations or conflicts with other third party plugins may result in the DHL plugin to behave unexpectedly or not function.
DHL offers no warranty or guarantee's that plugins will operate for your specific site.
1. Install the extension app
Before installing any extension, please create a backup of the root folder of the Magento website and of the database.
- Download the Magento 2 extension file
- Unpack the dhlexpress-services-3.0.0.zip file you've downloaded.
- Connect to the server where the website source folder is located with FTP/SFTP/SSH client
- Upload all files and folders that you have unpacked to the root folder of your Magento website.
- Connect to your Magento directory with SSH
- Run the following commands:
- php bin/magento setup:upgrade
- php bin/magento setup:di:compile
- php bin/magento setup:static-content:deploy
2. Generate your API key
- Log into DHL Express Commerce
- Go to Settings, then select API.
- If the API Key field is blank, click Regenerate, then click Save.
- Copy the API key. You will need to paste this into your Magento Admin panel.
3. Add your API key in Magento 2
- Go to your Magento Admin Dashboard, select Stores.
- Under Settings, select Configuration.
- Select Sales, then click Shipping Methods and select DHL Rates from the list.
- Set Enabled to Yes.
- Paste your API key in the API Key field.
- Fill in the required fields according to your preferences.
- Click Save Config.
4. Set Checkout Rates calculation method
- Go to Settings > Checkout Rates
- Select an option on how rates are calculated
- Single Package using sum of integration item weights
- Ignore any dimensions passed through from your ecommerce platform and total up the weight of all items in 1 package.
- Single Package using sum of integration item weights and integration item dimensions
- Total up all item weights and dimensions from your ecommerce platform into 1 Package.
- Total up all item weights and dimensions from your ecommerce platform into 1 Package.
- Single Package using default package weight and default dimensions
- Ignore weights and dimensions from ecommerce platforms and always use the 1 default package set up in Settings > Package Setup
- Ignore weights and dimensions from ecommerce platforms and always use the 1 default package set up in Settings > Package Setup
- Unique Package for each item using integration item weights and integration item dimensions
- This setting is not applicable to Magento at this moment of time
- Single Package using sum of integration item weights
Your checkout should now display your live rates.
5. Set up dimension attributes for products
To use dimension when getting rates you will need to create the custom attributes in the Magento2 store.
Please note:
When importing orders from Magento2 we are considering that the dimensions are coming in meters (m).
What will be displayed in your order when you open it up will be the imported dimension converted in the Display Sizes Unit that you have set in Settings > Options.
You need to create these 3 custom attributes, which need to be set up in all lowercase format as per below
- length
- height
- width
Like in this example:
All custom attributes created for one product will be created for all products as empty fields. If the fields are empty or if you have set a non numeric character in the dimension, then it will assume zero when getting rates.
Once the attributes are created, it will start working next time the you add this product in the shopping cart.
To add a custom attribute go in Edit any product and click in:
Add Attribute:
Then click in Create New Attribute:
Then set the name of the attribute in the field "Attribute Label". Leave the Catalog input Type as "Text Field".
Troubleshooting
Rates are showing higher than expected
In your DEC profile some configuration may be required to correctly identify the weights supplied by Magento in their API. Please follow the below steps:
- Go to Settings, then select Options.
- Select Rates at Checkout Weight Unit.
- Set this setting value to Grams (g).
- Click Save.
- Retest the rates at checkout and validate if the rates are now correct.