Skip to content

Commit

Permalink
fix: Remoção das linhas nao utilizadas na função build_discount_item_…
Browse files Browse the repository at this point in the history
…for_subscription
  • Loading branch information
lucastgama committed Jun 14, 2024
1 parent 7974052 commit 7b35113
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/utils/PaymentProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,6 @@ public function build_product_items($product, $order_type = 'bill')
}

$new_item = $this->calculate_discount($product_items);
error_log(var_export($product_items,true));
error_log(var_export($new_item,true));
return $new_item;
}

Expand Down Expand Up @@ -1006,7 +1004,6 @@ protected function build_discount_item_for_subscription($coupon, $order_item, $p
$discount_item = [];
$amount = $coupon->get_amount();
$discount_type = $coupon->get_discount_type();

if ($discount_type == 'fixed_cart') {
$total_cart = WC()->cart->subtotal;
$percentage_item = $order_item['subtotal'] / $total_cart;
Expand All @@ -1022,15 +1019,11 @@ protected function build_discount_item_for_subscription($coupon, $order_item, $p
} elseif (strpos($discount_type, 'fixed') !== false) {
$discount_item['discount_type'] = 'amount';
$discount_item['amount'] = (float) $amount;
} elseif (
strpos($discount_type, 'percent') !== false ||
strpos($discount_type, 'recurring_percent') !== false
) {
} elseif (strpos($discount_type, 'percent') !== false ||strpos($discount_type, 'recurring_percent') !== false) {
$discount_item['discount_type'] = 'amount';
$discount_item['amount'] = abs($amount / 100 * ($order_item['price'] * $order_item['quantity']));
}
$discount_item['cycles'] = $this->config_discount_cycles($coupon, $plan_cycles);

return $discount_item;
}

Expand Down

0 comments on commit 7b35113

Please sign in to comment.