From e028cca39515ced04cd52a56b30cc793bb48cbb4 Mon Sep 17 00:00:00 2001 From: Davod Saraei Date: Wed, 22 Dec 2021 20:30:08 +0330 Subject: [PATCH] check currency --- classes/Woocommerce.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/Woocommerce.php b/classes/Woocommerce.php index 24998d1..68ea980 100644 --- a/classes/Woocommerce.php +++ b/classes/Woocommerce.php @@ -18,10 +18,10 @@ public function __construct() public function getOrderData($order) { - $coupon = ''; $products = []; foreach ($order->get_items() as $item) { $item_subtotal = floatval($this->wooRound($item->get_subtotal())); + $item_subtotal = $order->get_currency() === 'IRT' ? $item_subtotal * 10 : $item_subtotal; $products[] = [ 'product_page_id' => $item->get_product_id(), @@ -32,6 +32,7 @@ public function getOrderData($order) ]; } + $coupon = ''; if ($this->isWoo3()) { if ($coupons = $order->get_data()['coupon_lines']) { $coupon = array_values($coupons)[0]->get_code() ?? '';