Fix client info if shipping address empty, use billing address
This commit is contained in:
parent
c7c3065834
commit
2fd1a1088b
@ -91,12 +91,13 @@ abstract class WC_Retailcrm_Abstracts_Address extends WC_Retailcrm_Abstracts_Dat
|
||||
protected function getOrderAddress($order)
|
||||
{
|
||||
$orderAddress = $order->get_address($this->address_type);
|
||||
|
||||
if (empty($orderAddress) && $this->address_type === self::ADDRESS_TYPE_BILLING && $this->fallback_to_shipping) {
|
||||
$checkEmptyArray = array_filter($orderAddress);
|
||||
|
||||
if (empty($checkEmptyArray) && $this->address_type === self::ADDRESS_TYPE_BILLING && $this->fallback_to_shipping) {
|
||||
$orderAddress = $order->get_address(self::ADDRESS_TYPE_SHIPPING);
|
||||
}
|
||||
|
||||
if (empty($orderAddress) && $this->address_type === self::ADDRESS_TYPE_SHIPPING && $this->fallback_to_billing) {
|
||||
if (empty($checkEmptyArray) && $this->address_type === self::ADDRESS_TYPE_SHIPPING && $this->fallback_to_billing) {
|
||||
$orderAddress = $order->get_address(self::ADDRESS_TYPE_BILLING);
|
||||
}
|
||||
|
||||
|
@ -64,9 +64,9 @@ class WC_Retailcrm_Order extends WC_Retailcrm_Abstracts_Data
|
||||
|
||||
$data = array(
|
||||
'externalId' => $order->get_id(),
|
||||
'createdAt' => $order->get_date_created()->date('Y-m-d H:i:s'),
|
||||
'firstName' => $order->get_shipping_first_name(),
|
||||
'lastName' => $order->get_shipping_last_name(),
|
||||
'createdAt' => $order->get_date_created()->date('Y-m-d H:i:s'),
|
||||
'firstName' => $firstName,
|
||||
'lastName' => $lastName,
|
||||
'email' => strtolower($order->get_billing_email()),
|
||||
'customerComment' => $order->get_customer_note(),
|
||||
'phone' => $order->get_billing_phone(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user