Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Last active March 5, 2021 12:11
Show Gist options
  • Select an option

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

Select an option

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