From 6e6d17144e2c9347ddacc0b3cae88fbf5851e8cf Mon Sep 17 00:00:00 2001 From: Kcppdevelopers Date: Mon, 13 Mar 2017 15:52:45 +0530 Subject: [PATCH] Free Orders where shipping is all that needs to be paid, ref #361 --- classes/wc-gateway-paypal-express-angelleye.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/classes/wc-gateway-paypal-express-angelleye.php b/classes/wc-gateway-paypal-express-angelleye.php index e665a8d28..2f20d196c 100644 --- a/classes/wc-gateway-paypal-express-angelleye.php +++ b/classes/wc-gateway-paypal-express-angelleye.php @@ -677,16 +677,17 @@ public static function angelleye_get_paypalimage() { public function handle_wc_api() { try { + require_once( PAYPAL_FOR_WOOCOMMERCE_PLUGIN_DIR . '/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-request-angelleye.php' ); + $paypal_express_request = new WC_Gateway_PayPal_Express_Request_AngellEYE($this); if (!isset($_GET['pp_action'])) { return; } - if (WC()->cart->cart_contents_total <= 0) { + if (WC()->cart->cart_contents_total <= 0 && WC()->cart->total <= 0) { wc_add_notice(__('your order amount is zero, We were unable to process your order, please try again.', 'paypal-for-woocommerce'), 'error'); - wp_redirect(WC()->cart->get_cart_url()); + $paypal_express_request->angelleye_redirect(); exit; } - require_once( PAYPAL_FOR_WOOCOMMERCE_PLUGIN_DIR . '/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-request-angelleye.php' ); - $paypal_express_request = new WC_Gateway_PayPal_Express_Request_AngellEYE($this); + switch ($_GET['pp_action']) { case 'set_express_checkout': if ((isset($_POST['wc-paypal_express-new-payment-method']) && $_POST['wc-paypal_express-new-payment-method'] = 'on') || ( isset($_GET['ec_save_to_account']) && $_GET['ec_save_to_account'] == true)) {