Created
December 2, 2019 13:45
-
-
Save shadimanna/b4a6ab1d4f8efcf6061cb5da3bbdb7e4 to your computer and use it in GitHub Desktop.
This file contains 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
add_filter('pr_shipping_dhl_label_args', 'modify_order_id_to_number', 10, 2); | |
function modify_order_id_to_number($args, $order_id) { | |
$order = wc_get_order( $order_id ); | |
$args['dhl_settings']['dhl_label_ref'] = $order->get_order_number(); | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot for that code! I use Woocoommerce and DHL Paket plugin on Wordpress. My goal is to put some product information on my DHL label. Could be at Shipper Contact, Customer Contact or Reference ID field. I tried to access the variables on the label via add_filter('pr_shipping_dhl_label_args'...) like you show in your code examples. But i am not able to access any of the arguments. Nothing changes on the label. Do you have an idea what the problem is? For example i tried this:
add_filter('pr_shipping_dhl_label_args', 'modify_order_id_to_number', 10, 2); function modify_order_id_to_number($args, $order_id) { $args['dhl_settings']['dhl_label_ref'] = "dummy text"; // or this: $args['shipping_address']['phone'] = "dummy text"; return $args; }
Nothing happens on the label. Do you have an idea what might be wrong? Thank you very much!