Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created June 23, 2022 09:36
Show Gist options
  • Save hedqvist/833e6f90186445eb9e6a72efb6c6b937 to your computer and use it in GitHub Desktop.
Save hedqvist/833e6f90186445eb9e6a72efb6c6b937 to your computer and use it in GitHub Desktop.
<?php
/**
* @snippet WooCommerce - Adds ADDON to Shipment
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 6.0.0
*/
function redlight_unifaun_dhl_addon_spbag( $shipment, $order ) {
// Only ASPO - DHL Service Point
if( 'ASPO' === $shipment['service']['id'] ){
$shipment['service']['addons'][] = array(
'id' => 'SPBAG'
);
}
return $shipment;
}
add_filter('ac_wc_unifaun_shipment_data', 'redlight_unifaun_dhl_addon_spbag', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment