Skip to content

Instantly share code, notes, and snippets.

@shadimanna
Created October 5, 2018 10:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shadimanna/45cf9640f51c90e1d03241cd951bd52d to your computer and use it in GitHub Desktop.
Save shadimanna/45cf9640f51c90e1d03241cd951bd52d to your computer and use it in GitHub Desktop.
add_filter('pr_shipping_dhl_label_args', 'modify_post_number', 10, 2);
function modify_post_number($args, $order_id) {
if( $order_id == 12345 ){
$args['shipping_address']['dhl_postnum'] = 54321;
}
return $args;
}
@Nex4rius
Copy link

Nex4rius commented Aug 3, 2021

Your solution has the hardcoded order_id and postnumber which obviously only works on this one order. I made it generalized for all orders. It's just strange that the DHL plugin adds the postnumber field but somehow still complains that the postnumber is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment