What can we help you with?

Enable Calculating DHL Shipping in Shop page While Adding Items to the Cart (Code Snippet)

By default, the ELEX WooCommerce DHL Plugin does not calculate shipping rates while customers are adding products to the cart. While some of us find it useful, you can still change this using a simple code snippet.

Calculating DHL Shipping in Shop page While Adding Items to the Cart

Add the following code snippet to the functions.php file of website’s activated theme.

/*Filter to enable calculating shipping rates while adding items to the cart*/
add_filter('calculate_shipping_in_shop_page_express_dhl_elex', 'shipping_rates_calculator_on_shop_page_express_dhl_elex');

function shipping_rates_calculator_on_shop_page_express_dhl_elex($calculate)
    return $calculate = true;

Save the file. The ELEX WooCommerce DHL Plugin will dynamically calculate shipping rate, as and when the products are added to the cart.


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 Hide Shipping Cost on the DHL Shipping labels and Commercial Invoices (Code Snippet)
Next How to provide multiple DHL Pickup addresses in WooCommerce DHL Express Shipping?
You must be logged in to post a comment.