1
0
mirror of synced 2025-03-26 10:03:53 +03:00

Do not create orders with the auto-draft status

This commit is contained in:
Dima Uryvskiy 2021-03-15 18:14:58 +03:00 committed by GitHub
parent adfc893c95
commit 3ba2f1662e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 15 deletions

View File

@ -371,6 +371,10 @@ if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) :
return; return;
} }
if ($order->get_status() == 'auto-draft') {
return;
}
if ($update === true) { if ($update === true) {
$this->orders->is_new = false; $this->orders->is_new = false;
} }

View File

@ -56,15 +56,16 @@ class WC_Retailcrm_Order extends WC_Retailcrm_Abstracts_Data
$firstName = $order->get_shipping_first_name(); $firstName = $order->get_shipping_first_name();
$lastName = $order->get_shipping_last_name(); $lastName = $order->get_shipping_last_name();
if(empty($firstName) && empty($lastName)) if (empty($firstName) && empty($lastName)) {
{
$firstName = $order->get_billing_first_name(); $firstName = $order->get_billing_first_name();
$lastName = $order->get_billing_last_name(); $lastName = $order->get_billing_last_name();
} }
$dateCreate = $order->get_date_created();
$data = array( $data = array(
'externalId' => $order->get_id(), 'externalId' => $order->get_id(),
'createdAt' => $order->get_date_created()->date('Y-m-d H:i:s'), 'createdAt' => !empty($dateCreate) ? $dateCreate->date('Y-m-d H:i:s') : date('Y-m-d H:i:s'),
'firstName' => $firstName, 'firstName' => $firstName,
'lastName' => $lastName, 'lastName' => $lastName,
'email' => strtolower($order->get_billing_email()), 'email' => strtolower($order->get_billing_email()),