Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created May 2, 2023 10:50
Show Gist options
  • Save hedqvist/ec404ce0435e81d7c4052a1896017c30 to your computer and use it in GitHub Desktop.
Save hedqvist/ec404ce0435e81d7c4052a1896017c30 to your computer and use it in GitHub Desktop.
nShift - DoorCode
<?php
/**
* @snippet WooCommerce - Sets customer note as deliveryInstruction in Unifaun
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 7.5.0
*/
function redlight_unifaun_customer_portkod( $shipment, $order ) {
// How to add Custom DoorCode
if(!empty( $order->get_meta('portkod') ) ){
$shipment['receiver']['doorCode'] = $order->get_meta('portkod');
$shipment['doorCode'] = $order->get_meta('portkod');
}
return $shipment;
}
add_filter('ac_wc_unifaun_shipment_data', 'redlight_unifaun_customer_portkod', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment