Использование ФИО из платежного адреса, в случае, если ФИО в адресе доставки пусто
This commit is contained in:
parent
754e1e8245
commit
155a2d5716
@ -189,8 +189,17 @@ if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) :
|
||||
}
|
||||
|
||||
if ($update && $customerWasChanged) {
|
||||
$this->order['firstName'] = $wcOrder->get_shipping_first_name();
|
||||
$this->order['lastName'] = $wcOrder->get_shipping_last_name();
|
||||
$firstName = $wcOrder->get_shipping_first_name();
|
||||
$lastName = $wcOrder->get_shipping_last_name();
|
||||
|
||||
if(empty($firstName) && empty($lastName))
|
||||
{
|
||||
$firstName = $wcOrder->get_billing_first_name();
|
||||
$lastName = $wcOrder->get_billing_last_name();
|
||||
}
|
||||
|
||||
$this->order['firstName'] = $firstName;
|
||||
$this->order['lastName'] = $lastName;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -53,11 +53,20 @@ class WC_Retailcrm_Order extends WC_Retailcrm_Abstracts_Data
|
||||
*/
|
||||
public function build($order)
|
||||
{
|
||||
$firstName = $order->get_shipping_first_name();
|
||||
$lastName = $order->get_shipping_last_name();
|
||||
|
||||
if(empty($firstName) && empty($lastName))
|
||||
{
|
||||
$firstName = $order->get_billing_first_name();
|
||||
$lastName = $order->get_billing_last_name();
|
||||
}
|
||||
|
||||
$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(),
|
||||
'firstName' => $firstName,
|
||||
'lastName' => $lastName,
|
||||
'email' => $order->get_billing_email(),
|
||||
'customerComment' => $order->get_customer_note(),
|
||||
'phone' => $order->get_billing_phone(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user