Articles in this section

Magento 2: Rates at Checkout

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.

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 that plugins will operate for your specific site.

Before you begin

  • Configure rates at checkout in DHL Express Commerce.
  • Enable DHL products to be shown at checkout under Settings > Checkout Rates in DHL Express Commerce. If you add new products, toggle Delivery Options off and on again to refresh the available products with your store. 

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.

  1. Download the Magento 2 extension file.
  2. Unpack the dhlexpress-services-3.0.0.zip file you've downloaded.
  3. Connect to the server where the website source folder is located with FTP/SFTP/SSH client.
  4. Upload all files and folders that you have unpacked to the root folder of your Magento website.
  5. Connect to your Magento directory with SSH.
  6. Run the following commands:
    1. php bin/magento setup:upgrade
    2. php bin/magento setup:di:compile
    3. php bin/magento setup:static-content:deploy

2. Generate your API key

  1. In DHL Express Commerce, go to Settings > API.
  2. If the API Key field is blank, click Regenerate, then click Save.
  3. Copy the API key. You will need to paste this into your Magento Admin panel.

3. Add your API key in Magento 2

  1. Go to your Magento Admin Dashboard, select Stores.
  2. Under Settings, select Configuration.
  3. Select Sales, then click Shipping Methods and select DHL Rates from the list.
  4. Set Enabled to Yes.
  5. Paste your API key in the API Key field.
  6. Fill in the required fields according to your preferences.
  7. Click Save Config.

4. Set up dimension attributes for products

How to use dimensions for live rates

DHL Express Commerce supports dimensions for live rates at checkout for Adobe Commerce. To start using dimensions, you will need to create custom attributes in your Adobe Commerce store.

To create a custom attribute:

  1. Open your Adobe Commerce admin panel.
  2. Navigate to Stores > Attributes > Product.
  3. Click the Add New Attribute button.
  4. Create the following custom attributes using the exact spelling (not case-sensitive) under the Attribute Label field:
    • Length
    • Height
    • Width
  5. Leave the Catalog input Type as Text Field.
  6. Click Save Attribute for each attribute.

All custom attributes created for one product will also be created for all products as empty fields. If the fields are empty or if the customer sets a non-numeric character in the dimension, DHL Express Commerce will assume the value as zero when getting rates.

Once the attributes are added, live rates using dimensions will be available to customers immediately.

Troubleshooting

Rates are showing higher than expected

In your DHL Express Commerce account, some configuration may be required to correctly identify the weights supplied by Magento in their API. Please follow the steps below:

  1. Go to Settings > Options.
  2. Under Rates at Checkout Weight Unit, set the value to Grams (g).
  3. Click Save.
  4. Retest the rates at checkout and validate if the rates are now correct.
Was this article helpful?
0 out of 1 found this helpful