Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created August 11, 2020 13:22
Show Gist options
  • Select an option

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

Select an option

Save hedqvist/630bfaf22dfda7920aa938d06dda07b9 to your computer and use it in GitHub Desktop.
Unifaun - Force 250g on all parcels
/**
* @snippet WooCommerce - Sets Weight on Parcels (Overwrites weight total)
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 4.4.0
*/
function redlight_unifaun_parcel_weight( $shipment, $order) {
foreach( $shipment['parcels'] as $i => $parcel ) {
$shipment['parcels'][$i]['weight'] = 0.250;
}
return $shipment;
}
add_filter('ac_wc_unifaun_shipment_data', 'redlight_unifaun_parcel_weight', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment