WooCommerce DPD UK – Additional hooks

woocommerce_dpd_uk_label_data

woocommerce_dpd_uk_label_data – a hook which allows to create e.g. the return label after the main one was generated.

Hook documentation:

/**
* Can perform action after label received form API or modify received label.
*
* @param array $label_data Label data.
* @param WPDesk_Flexible_Shipping_Shipment_dpd_uk $shipment Shipment.
*
* @return array
*
* Label data is an array with keys:
* - content: label received from API
* - label_format
* - file_name
*
* Shipment is instance of WPDesk_Flexible_Shipping_Shipment_dpd_uk class.
* To access order use this code: $shipment->get_order();
*/

woocommerce_dpd_uk_shipment_data

woocommerce_dpd_uk_shipment_data – a hook which allows to change all the shipment data e.g. the collection date or package weight before sending it to DPD UK API.

Hook documentation:

/**
* Can modify shipment data before send it to API.
*
* @param array $shipment_data Shipment data.
* @param WPDesk_Flexible_Shipping_Shipment_dpd_uk $shipment Shipment.
*
* @return array
*
* Shipment data is an array with data required by API to create shipment.
*
* Shipment is instance of WPDesk_Flexible_Shipping_Shipment_dpd_uk class.
* To access order use this code: $shipment->get_order();
*/

Filter documentation

By default, an order note about the creation nor cancelation of a shipment is not sent to the customer.

woocommerce_dpd_uk_shipment_created_is_customer_note

woocommerce_dpd_uk_shipment_created_is_customer_note – a filter that enables automatic dispatch of the note after creating the shipment. In order for the note to be sent, in functions.php you need to add: add_filter( 'woocommerce_dpd_uk_shipment_deleted_is_customer_note', function() { return 1; } );

woocommerce_dpd_uk_shipment_deleted_is_customer_note

woocommerce_dpd_uk_shipment_deleted_is_customer_note – a filter that enables automatic dispatch of the note after removing the shipment. In order for the note to be sent, in functions.php you should add: add_filter( 'woocommerce_dpd_uk_shipment_deleted_is_customer_note', function() { return 1; } );

Scroll to Top