Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created May 28, 2020 14:36
Show Gist options
  • Select an option

  • Save hedqvist/b286fa9f574514f4efa462f5c420f9c7 to your computer and use it in GitHub Desktop.

Select an option

Save hedqvist/b286fa9f574514f4efa462f5c420f9c7 to your computer and use it in GitHub Desktop.
Unifaun - DHL GREEN Addon
<?php
/**
* @snippet WooCommerce - Adds ADDON to Shipment
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 4.1.1
*/
function redlight_unifaun_dhl_green( $shipment, $order ) {
// Only APC service ID (DHL Parcel Connect)
if( 'APC' === $shipment['service']['id'] ){
$shipment['service']['addons'][] = array(
'id' => 'GREEN'
);
}
return $shipment;
}
add_filter('ac_wc_unifaun_shipment_data', 'redlight_unifaun_dhl_green', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment