Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created March 8, 2019 08:29
Show Gist options
  • Select an option

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

Select an option

Save hedqvist/acee9fcc417998c31bfe4d8ca8c71365 to your computer and use it in GitHub Desktop.
Angry Creative Unifaun - Schenker Dimensions on Parcel
<?php
/**
* @snippet WooCommerce - Adds Dimensions to Schenker Parcel
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 3.5.3
*/
function redlight_unifaun_schenker_dimensions( $shipment, $order) {
if( 'BHP' === $shipment['service']['id'] ){
foreach( $shipment['parcels'] as $i => $parcel ) {
$shipment['parcels'][$i]['length'] = 240;
$shipment['parcels'][$i]['width'] = 190;
$shipment['parcels'][$i]['height'] = 90;
}
}
return $shipment;
}
add_filter('ac_wc_unifaun_shipment_data', 'redlight_unifaun_schenker_dimensions', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment