WC_Order::get_billing_phone PHP Method

get_billing_phone() public method

Get billing_phone.
public get_billing_phone ( string $context = 'view' ) : string
$context string
return string
    public function get_billing_phone($context = 'view')
    {
        return $this->get_address_prop('phone', 'billing', $context);
    }

Usage Example

 /**
  * Get phone number args for paypal request.
  * @param  WC_Order $order
  * @return array
  */
 protected function get_phone_number_args($order)
 {
     if (in_array($order->get_billing_country(), array('US', 'CA'))) {
         $phone_number = str_replace(array('(', '-', ' ', ')', '.'), '', $order->get_billing_phone());
         $phone_number = ltrim($phone_number, '+1');
         $phone_args = array('night_phone_a' => substr($phone_number, 0, 3), 'night_phone_b' => substr($phone_number, 3, 3), 'night_phone_c' => substr($phone_number, 6, 4), 'day_phone_a' => substr($phone_number, 0, 3), 'day_phone_b' => substr($phone_number, 3, 3), 'day_phone_c' => substr($phone_number, 6, 4));
     } else {
         $phone_args = array('night_phone_b' => $order->get_billing_phone(), 'day_phone_b' => $order->get_billing_phone());
     }
     return $phone_args;
 }
All Usage Examples Of WC_Order::get_billing_phone
WC_Order