How to change order status as “Completed” when DHL shipment is created? (Code Snippet)

You are here:

After you have created DHL shipment and print labels with ELEX DHL Shipping Plugin, you need to manually change the WooCommerc order status to “Completed”, to complete the order processing. Thankfully, with an easy code snippet, you can automate this process.

Code snippet to change order status as “Completed” when DHL shipment is created

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

/* Filter to change order status as completed after creation of the shipping label */

add_filter( 'elex_dhl_mark_order_status_completed', 'elex_dhl_mark_order_status_completed_function', 10, 1 );

function elex_dhl_mark_order_status_completed_function($order){
    $order->update_status('completed');
    return $order;
}

After you create DHL shipment, whether manually, using ELEX DHL Bulk label printing add-on, or ELEX DHL Autogenerate and Email label add-on, the order status will be changed to “Completed”.

 


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