Skip to content

Commit 5d949ae

Browse files
committed
Fix getTotal
1 parent 9e61c28 commit 5d949ae

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Payu/Gateways/WC_Payu_Gateways.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ protected function get_payu_pay_method_array( string $type, string $value, ?stri
10781078
*/
10791079
protected function check_min_max( $payMethod, $paytype = null ) {
10801080
if ( ( $paytype === null || $payMethod->value === $paytype ) && $payMethod->status === 'ENABLED' ) {
1081-
$total = $this->get_order_total() * 100;
1081+
$total = $this->getTotal() * 100;
10821082

10831083
if ( isset( $payMethod->minAmount ) && $total < $payMethod->minAmount ) {
10841084
return false;
@@ -1093,6 +1093,16 @@ protected function check_min_max( $payMethod, $paytype = null ) {
10931093
return false;
10941094
}
10951095

1096+
private function getTotal(): float {
1097+
if ( $this->order_total !== null ) {
1098+
return $this->order_total;
1099+
} elseif ( WC()->cart && 0 !== count( WC()->cart->get_cart_contents() ) ) {
1100+
return WC()->cart->get_cart_contents_total() + WC()->cart->get_cart_contents_tax() + WC()->cart->get_shipping_total() + WC()->cart->get_shipping_tax();
1101+
}
1102+
1103+
return 0;
1104+
}
1105+
10961106
/**
10971107
* @param string $notification
10981108
*

0 commit comments

Comments
 (0)