Created
February 27, 2026 13:57
-
-
Save webdados/be8a363fc4154c6cdb913385c98f28af to your computer and use it in GitHub Desktop.
Use order customer note as observations on the DPD Portugal for WooCommerce labels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Works on DPD Portugal for WooCommerce 14.0 and above | |
| add_filter( 'woo_dpd_portugal_shipment_data', function( $shipment_data, $order_id ) { | |
| if ( empty( trim( $shipment_data['comments'] ) ) ) { | |
| $order = wc_get_order( $order_id ); | |
| if ( $order ) { | |
| $shipment_data['comments'] = trim( $order->get_customer_note() ); | |
| } | |
| } | |
| return $shipment_data; | |
| }, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment