What can we help you with?

How to provide multiple DHL Pickup addresses in WooCommerce DHL Express Shipping?

Given snippet is no longer working because of external dependencies. We are working on an alternative solution to update the article. Request not to follow the article for the time being. Sorry for the inconvenience caused.

If you have multiple stores or warehouses, it might be difficult to process parcel pickups, as you need to specify multiple addresses and parcel information.

To overcome this situation, ELEX has provided a code snippet that allows you to specify multiple DHL pickup addresses in WooCommerce DHL Express Shipping. All you need to do is create a custom shipping classes for your pickup addresses and assign them to products. When a pickup request is sent to DHL, the address associated with the product is also sent. This allows the DHL pickup staff to pick up the specified package from the designated address.

This solution works only for ELEX WooCommerce DHL Express / eCommerce / Paket Shipping Plugin with Print Label.

Multiple DHL Pickup Addresses in WooCommerce DHL Express Shipping

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

/* Filter to provide multiple pickup locations */

add_filter("multiple_pickup_locations_express_dhl_elex", "multiple_pickup_locations_express_dhl_elex", 10);

function multiple_pickup_locations_express_dhl_elex(){
    /* 
    * Sample pickup locations. Please provide desired pickup locations with valid DHL Site Account Numbers 
    * The pickup1 and pickup2 are the shipping classes' names linked to the products  */

    return $pickup_address = array(

        'pickup1' => array(

            'shipper_id' => '301439699',

            'company_name' => str_replace("&", '&', 'ShippingCompany'),

            'registered_account' => '301439699',

            'address_line' => 'Av. de Madrid',

            'address_line2' => '160',

            'city' => 'Barcelona',

            'division' => 'BCT',

            'division_code' => 'BCT',

            'postal_code' => '08028',

            'country_code' => 'ES',

            'contact_person_name' => 'Mark',

            'contact_phone_number' => '789653210',

            'contact_email' => 'marklogistics@gmail.com',

        ),

        'pickup2' => array(

            'shipper_id' => '301439699',

            'company_name' => str_replace("&", '&', 'ShippingCompany'),

            'registered_account' => '301439699',

            'address_line' => 'Av. de Madrid',

            'address_line2' => '160',

            'city' => 'Barcelona',

            'division' => 'BCT',

            'division_code' => 'BCT',

            'postal_code' => '08026',

            'country_code' => 'ES',

            'contact_person_name' => 'John',

            'contact_phone_number' => '789653210',

            'contact_email' => 'johnlogistics@gmail.com',

        )

    );

}

The above code snippet supports two pickup addresses. It uses shipping classes “pickup1” and “pickup2“. You need to create desired shipping classes, replace with pickup1 and pickup2, and specify the addresses in the fields.

 


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 Enable Calculating DHL Shipping in Shop page While Adding Items to the Cart (Code Snippet)
Next How to change order status as “Completed” when DHL shipment is created? (Code Snippet)
You must be logged in to post a comment.