Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Last active February 25, 2020 19:02
Show Gist options
  • Select an option

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

Select an option

Save hedqvist/98b4700db4e73c269e541df7b016b6a5 to your computer and use it in GitHub Desktop.
Unifaun - Change Phonenumber
<?php
/**
* @snippet WooCommerce - Sets custom phone in Unifaun
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 3.9.2
*/
function redlight_unifaun_custom_phone( $shipment, $order ) {
$shipping_phone= $order->get_meta( '_shipping_phone', true );
if(!empty( $shipping_phone ) ){
$shipment['receiver']['phone'] = $shipping_phone;
$shipment['receiver']['mobile'] = $shipping_phone;
}
return $shipment;
}
add_filter('ac_wc_unifaun_shipment_data', 'redlight_unifaun_custom_phone', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment