Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created March 31, 2020 18:48
Show Gist options
  • Select an option

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

Select an option

Save hedqvist/fd41b59934febdf0616007ab3e5477f9 to your computer and use it in GitHub Desktop.
Unifaun - Varubrev Corona - Lämnas vid dörr
<?php
/**
* @snippet WooCommerce - Adds ADDON to Shipment
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 4.0.1
*/
function redlight_unifaun_varubrev_covid19( $shipment, $order ) {
// Only PUA
if( 'PUA' === $shipment['service']['id']){
$shipment['service']['addons'][] = array(
'id' => 'SPBAG'
);
}
return $shipment;
}
add_filter('ac_wc_unifaun_shipment_data', 'redlight_unifaun_varubrev_covid19', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment