How to provide Consignee’s company name on the DHL Express shipping label? (Code Snippet)

You are here:

By default, the WooCommerce order ID is printed in the reference on the DHL Express shipping label, generated using ELEX DHL Shipping Plugin. One of our customers requested customization where he wanted to print the Consignee’s (customer) company name for easy reference.

This was achieved using a simple code snippet that was provided to him by ELEX.

Code snippet to provide Consignee’s company name on the DHL Express shipping label

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

/* Filter provide Consignee's company name as reference on the Shipping Label */
add_filter("add_shipping_reference_express_dhl_elex", "add_shipping_reference_express_dhl_elex", 10, 2);

function add_shipping_reference_express_dhl_elex($default_shipping_reference, $custom_reference = 'ELEXtensions'){
if(!empty($custom_reference)){
$default_shipping_reference = $custom_reference;// user can provide desired reference data for custom reference
}
return $default_shipping_reference;

In the above code snippet, replace “ELEXtensions” with desired content.

 


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

Read the product documentation of DHL Express to understand the plugin, in detail. Or check out the knowledge base section for more related articles.

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

    Leave a Reply

    WordPress Image Lightbox Plugin