Skip to content

Commit

Permalink
fix: fix payment without decimals in price
Browse files Browse the repository at this point in the history
  • Loading branch information
matesasesinos committed May 3, 2023
1 parent 3109f82 commit 81b2b1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion class-gocuotas.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function restrict_payment_option($available_gateways)
$order_total = WC()->cart->total;
}

if(get_option('woocommerce_gocuotas_settings', true)['max_total'] < $order_total && get_option('woocommerce_gocuotas_settings', true)['max_total']!= '') {
if (get_option('woocommerce_gocuotas_settings', true)['max_total'] < $order_total && get_option('woocommerce_gocuotas_settings', true)['max_total'] != '') {
unset($available_gateways['gocuotas']);
}

Expand Down Expand Up @@ -200,6 +200,10 @@ public function process_payment($order_id)
$total = str_replace(".", "", $total);
$total = str_replace(",", "", $total);

if (intval(get_option('woocommerce_price_num_decimals')) == 0) {
$total = number_format($total, 2, '', '');
}

$order_received_url = wc_get_endpoint_url('order-received', $order->get_id(), wc_get_checkout_url());
$order_received_url_ok = $order_received_url . "done/";

Expand Down
4 changes: 2 additions & 2 deletions gocuotas.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Plugin Name: Go Cuotas
* Version: 1.1.9
* Version: 1.2.0
* Author: Juan Iriart
* Text Domain: gocuotas
* Description: Plugin para integración de Go Cuotas en WooCommerce
Expand All @@ -12,7 +12,7 @@
exit;
}

define('GC_VERSION', '1.1.9');
define('GC_VERSION', '1.2.0');

require_once plugin_dir_path(__FILE__) . 'class-helper.php';

Expand Down

0 comments on commit 81b2b1d

Please sign in to comment.