Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created March 7, 2020 12:39
Show Gist options
  • Select an option

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

Select an option

Save hedqvist/4ed37b5e13b50e3ac96fb9f8f59a7be8 to your computer and use it in GitHub Desktop.
Unifaun - MyPack over 1500
<?php
/**
* @snippet WooCommerce - Change Service to MyPack Collect if order total over 1500
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 3.9.0
*/
function redlight_unifaun_mypack_over_1500( $shipment, $order ) {
if($order->get_total() > 1500 ){
$shipment['service']['id'] = 'P19';
}
return $shipment;
}
add_filter('ac_wc_unifaun_shipment_data', 'redlight_unifaun_mypack_over_1500', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment