What can we help you with?

Hide Shipping Cost on the DHL Shipping labels and Commercial Invoices (Code Snippet)

As a store owner, you might be offering Free shipping on your products for your customers. Although your customers can avail the free shipping facility, you need to personally pay for the shipping charge. In such situations, the shipping charge will be printed on the label and this may create unnecessary confusion for your customers, even though they are not being charged for this.

If you are using our ELEX WooCommerce DHL Shipping Plugin, we have a solution in the form of a code snippet that will override this problem.

Hiding Shipping Cost on DHL Shipping Labels and Commercial Invoices

With the code snippet given below in this article, you can hide shipping cost both in DHL shipping labels and commercial invoices generated using our ELEX WooCommerce DHL Plugin.

Below is a sample DHL Commercial Invoice showing the shipping cost by default.

Hide Shipping Cost on DHL Shipping labels and Commercial Invoices | Invoice with Shipping Cost
Commercial Invoice with Shipping Cost

Add the below code snippet at the end of the functions.php file of your activated website theme.

/* Filter to disable Shipping cost on the Shipping Label */
add_filter("disable_shipping_cost_shipping_label_elex_dhl_express", "disable_shipping_cost_shipping_label_elex_dhl_express", 10, 1);

function disable_shipping_cost_shipping_label_elex_dhl_express($add_shipping_cost){
return $add_shipping_cost = false;

/* Filter to disable Shipping cost on the Commercial Invoice */
add_filter("disable_shipping_cost_commercial_invoice_elex_dhl_express", "disable_shipping_cost_commercial_invoice_elex_dhl_express", 10, 1);

function disable_shipping_cost_commercial_invoice_elex_dhl_express($package_details){
$package_details['total'] -= $package_details['shipping_cost'];

return $package_details;

After the shipment is created, you can see the new commercial invoice without the shipping charge, as shown in the screenshot below.

Hide Shipping Cost on DHL Shipping labels and Commercial Invoices | Invoice without Shipping Cost
Commercial Invoice without Shipping Cost



To explore more details about the plugins, go check out ELEX WooCommerce DHL Express / eCommerce / Paket Shipping Plugin with Print Label.

Read the article for setting up DHL Express understand the plugin, in detail. Or check out the product documentation section for more related articles.

You can also check out other WooCommerce and WordPress plugins in ELEX.

Previous Get DHL Tracking Numbers for WooCommerce Order IDs (Code Snippet)
Next Enable Calculating DHL Shipping in Shop page While Adding Items to the Cart (Code Snippet)
You must be logged in to post a comment.