What can we help you with?

Show Order’s Flat rate shipping cost and shipping tax on the DHL Commercial invoice (Code Snippet)

Chris has a WooCommerce store where he is using ELEX WooCommerce DHL Shipping Plugin to ease his shipping worries. He wants to show and charge the default WooCommerce flat rate and default tax for the customers in the front-end but wants to create shipments with DHL and ship the items.

With the current situation, his customers were shocked to see the high shipping rates (DHL rates) and its taxes in the Commercial invoice, as they had paid for the flat-rate and fairly less tax rate (default tax rate). With the ELEX WooCommerce DHL Shipping Plugin, Chris can access real-time rates, print shipping labels, return labels, commercial invoice, proforma invoice,   wants to show the order’s flat rate shipping cost and shipping tax on the DHL commercial invoice, which the customers have paid for during the checkout.

The Default Scenario and the Problem

Let us first look at the below screenshot which shows the WooCommerce flat rate we have set for regions all over the world.

Showing Order's Flat rate and Shipping Tax | WooCommerce Flat Rate settings
WooCommerce Flat Rate settings

In the below screenshot, you can see that a tax rate of 2% is configured for products as well as shipping.

Showing Order's Flat rate and Shipping Tax | WooCommerce Tax settings
WooCommerce Tax settings

Let us first look at the current scenario where the DHL rates and shipping tax will be displayed on the Commercial invoice.

Showing Order's Flat rate and Shipping Tax | Default DHL Commercial Invoice
DHL Commercial Invoice with DHL shipping rates and tax

To solve this problem, we offered Chris a simple code snippet to show the order’s flat rate and shipping tax.

Code snippet to Showing an Order’s Flat rate shipping cost and Shipping tax on DHL Commercial Invoice

Add the following code snippet in the functions.php file of your activated website theme.

/* Code snippet to show an order's Flat rate shipping cost and shipping tax on the DHL Commercial invoice  */
add_filter("get_order_shipping_cost_elex_dhl_express", "get_order_shipping_cost_elex_dhl_express", 10, 2);

function get_order_shipping_cost_elex_dhl_express($actual_shipping_cost, $order){
return array('shipping_cost' => $order->get_shipping_total(), 'shipping_tax' => $order->get_shipping_tax());
}

Once the above code snippet is saved, go ahead and create the shipment for the next orders or reset shipment for existing order in the WooCommerce orders dashboard.

The new Commercial Invoice with the flat rate and the shipping tax will be as shown in the screenshot below.

Showing Order's Flat rate and Shipping Tax | New DHL Commercial Invoice
DHL Commercial Invoice with WooCommerce Flat Rate and Tax

Hence, in this way, you can show Order’s Flat rate shipping and WooCommerce shipping tax in DHL Commercial Invoice, with ELEX WooCommerce DHL Shipping Plugin with Print Label.

 


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 to 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 Code Snippet to Rearrange Shipping Methods in cart page
Next Show Customer Selected Shipping Service in DHL Shipping Label (Code Snippet)
You must be logged in to post a comment.