Invent values if no orders found

[MAILPOET-5405]
This commit is contained in:
David Remer
2023-07-20 16:45:34 +03:00
committed by Veljko V
parent 1c56c3d87b
commit 7092b5713e

View File

@@ -101,12 +101,15 @@ class FreeOrderController implements OrderController {
'avatar' => $this->wp->getAvatarUrl($subscriber->getEmail(), ['size' => 20]), 'avatar' => $this->wp->getAvatarUrl($subscriber->getEmail(), ['size' => 20]),
], ],
'details' => [ 'details' => [
'id' => $currentOrder ? $currentOrder->get_id() : null, 'id' => $currentOrder ? $currentOrder->get_id() : 0,
'status' => $currentOrder ? [ 'status' => $currentOrder ? [
'id' => $currentOrder->get_status(), 'id' => $currentOrder->get_status(),
'name' => $this->woocommerce->wcGetOrderStatusName($currentOrder->get_status()), 'name' => $this->woocommerce->wcGetOrderStatusName($currentOrder->get_status()),
] : null, ] : [
'total' => $currentOrder ? (float)$currentOrder->get_total() : null, 'id' => 'completed',
'name' => $this->woocommerce->wcGetOrderStatusName('completed'),
],
'total' => $currentOrder ? (float)$currentOrder->get_total() : 0,
'products' => $products, 'products' => $products,
], ],
'email' => [ 'email' => [