Skip to content

Instantly share code, notes, and snippets.

@dennisnissle
Created June 17, 2024 13:25
Show Gist options
  • Save dennisnissle/939e98a13c8b37b07a64930e7e64436e to your computer and use it in GitHub Desktop.
Save dennisnissle/939e98a13c8b37b07a64930e7e64436e to your computer and use it in GitHub Desktop.
Use a different GLS contact id based on shipment data
<?php
add_filter( 'woocommerce_gzd_gls_label_api_request', function( $request, $label ) {
if ( $shipment = $label->get_shipment() ) {
$country = $shipment->get_country();
if ( 'AT' === $country ) {
$request['Shipment']['Shipper']['ContactID'] = '12345';
}
}
return $request;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment