Last active
February 25, 2020 19:02
-
-
Save hedqvist/98b4700db4e73c269e541df7b016b6a5 to your computer and use it in GitHub Desktop.
Unifaun - Change Phonenumber
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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