WooParc_make_address

Receive address information from plugin created order fields.

Description

WooParc_make_address( $order_id ); 

Parameters (1)

0. $order_id
The order id.

Usage

  1. if ( !function_exists( 'WooParc_make_address' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-postnl-parcelware/inc/funct-export.php'; 
  3.  
  4. // The order id. 
  5. $order_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = WooParc_make_address($order_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/inc/funct-export.php  
  1. function WooParc_make_address($order_id) { 
  2. global $woocommerce; 
  3. $order = new WC_Order($order_id); 
  4. $street=''; 
  5. if(isset($order->order_custom_fields['_shipping_street'][0])) { 
  6. $street=$order->order_custom_fields['_shipping_street'][0]; 
  7.  
  8. // If new checkout field "shipping_street" exists, use new address collect, otherwhise use old method 
  9. if(isset($street) && $street!="" && get_option('wooparc_convert_address')!='') { 
  10. $address=array($street, $order->order_custom_fields['_shipping_number'][0], $order->order_custom_fields['_shipping_number_ext'][0], $order->shipping_address_2); 
  11. } else { 
  12. $address=WooParc_get_address($order->shipping_address_1, $order->shipping_address_2); 
  13. return $address;