Skip to content

Commit

Permalink
check currency
Browse files Browse the repository at this point in the history
  • Loading branch information
davodsaraei committed Dec 22, 2021
1 parent 96dce49 commit e028cca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion classes/Woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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() ?? '';
Expand Down

0 comments on commit e028cca

Please sign in to comment.