From 9dda3c00671ab281bd87d8518f544b27f7dae276 Mon Sep 17 00:00:00 2001 From: ChetanGN Date: Thu, 21 Apr 2022 12:25:40 +0530 Subject: [PATCH 1/2] Removed COD intelligence config from wc dashboard and removed force COD arg from checkout arg list --- includes/api/api.php | 7 ------- includes/api/coupon-apply.php | 2 +- includes/api/order.php | 10 ++-------- includes/api/shipping-info.php | 2 +- woo-razorpay.php | 1 - 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/includes/api/api.php b/includes/api/api.php index 692c02cc..07550c0c 100644 --- a/includes/api/api.php +++ b/includes/api/api.php @@ -172,13 +172,6 @@ function addMagicCheckoutSettingFields(&$defaultFormFields) 'label' => __('Activate Mandatory Login for Magic Checkout'), 'default' => 'no', ), - 'enable_1cc_cod_intelligence' => array( - 'title' => __('Activate COD Intelligence'), - 'type' => 'checkbox', - 'description' => "By enabling this you allow Magic Checkout to decide which customer sees the COD option based on past shopping history", - 'label' => __('Activate Magic Checkout COD Intelligence'), - 'default' => 'no', - ), '1cc_min_COD_slab_amount' => array( 'title' => __('Set minimum amount (INR) for COD'), 'type' => 'number', diff --git a/includes/api/coupon-apply.php b/includes/api/coupon-apply.php index d92ad829..419fb9aa 100644 --- a/includes/api/coupon-apply.php +++ b/includes/api/coupon-apply.php @@ -58,7 +58,7 @@ function applyCouponOnCart(WP_REST_Request $request) return new WP_REST_Response($response, 400); } - + //check woo-discount-rule plugin disabling the coupons if (is_plugin_active('woo-discount-rules/woo-discount-rules.php')) { $discountOptions = get_option('woo-discount-config-v2', []); diff --git a/includes/api/order.php b/includes/api/order.php index fa052c46..a949d8c8 100644 --- a/includes/api/order.php +++ b/includes/api/order.php @@ -118,13 +118,12 @@ function createWcOrder(WP_REST_Request $request) // To remove coupon added on order. $coupons = $order->get_used_coupons(); - if(!empty($coupons)){ - foreach($coupons as $coupon){ + if (!empty($coupons)) { + foreach ($coupons as $coupon) { $order->remove_coupon($coupon); } $couponCode = $coupons[0]; } - //To remove by default shipping method added on order. $items = (array) $order->get_items('shipping'); @@ -220,11 +219,6 @@ function createWcOrder(WP_REST_Request $request) $response['customer_cart'] = $customer_cart ?? ''; } - if (empty(get_option('woocommerce_razorpay_settings')['enable_1cc_cod_intelligence']) === true - || get_option('woocommerce_razorpay_settings')['enable_1cc_cod_intelligence'] != 'yes') { - $response['force_cod'] = true; - } - $woocommerce->session->set(RZP_1CC_CART_HASH . $cartHash, $orderId); set_transient(RZP_1CC_CART_HASH . $orderId, $cartHash, 3600); set_transient($razorpay::SESSION_KEY, $orderId, 3600); diff --git a/includes/api/shipping-info.php b/includes/api/shipping-info.php index 840c00d1..1787e96b 100644 --- a/includes/api/shipping-info.php +++ b/includes/api/shipping-info.php @@ -332,7 +332,7 @@ function smartCodRestriction($addresses, $order) { $restriction = get_option('woocommerce_cod_settings'); $restrictionSettings = json_decode($restriction['restriction_settings']); - + $items = WC()->cart->get_cart(); $products = []; diff --git a/woo-razorpay.php b/woo-razorpay.php index 10960c08..4a6ddd35 100644 --- a/woo-razorpay.php +++ b/woo-razorpay.php @@ -174,7 +174,6 @@ public function __construct($hooks = true) $this->visibleSettings = array_merge($this->visibleSettings, array( 'enable_1cc', 'enable_1cc_mandatory_login', - 'enable_1cc_cod_intelligence', 'enable_1cc_test_mode', 'enable_1cc_debug_mode', 'enable_1cc_pdp_checkout', From 4daacaae9df1063af5efb9a9f62864b728851d17 Mon Sep 17 00:00:00 2001 From: ChetanGN Date: Thu, 21 Apr 2022 12:54:03 +0530 Subject: [PATCH 2/2] Version bump to 3.3.0 --- readme.txt | 5 ++++- woo-razorpay.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/readme.txt b/readme.txt index 4a8b5229..5bc6dc10 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: razorpay Tags: razorpay, payments, india, woocommerce, ecommerce Requires at least: 3.9.2 Tested up to: 5.9 -Stable tag: 3.2.2 +Stable tag: 3.3.0 Requires PHP: 5.6 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -41,6 +41,9 @@ This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has == Changelog == += 3.3.0 = +* Magic checkout COD intelligence config moved from wooc dashboard to razorpay dashboard. + = 3.2.2 = * Bug fix in admin config page for magic checkout diff --git a/woo-razorpay.php b/woo-razorpay.php index 4a6ddd35..2278e603 100644 --- a/woo-razorpay.php +++ b/woo-razorpay.php @@ -3,8 +3,8 @@ * Plugin Name: Razorpay for WooCommerce * Plugin URI: https://razorpay.com * Description: Razorpay Payment Gateway Integration for WooCommerce - * Version: 3.2.2 - * Stable tag: 3.2.2 + * Version: 3.3.0 + * Stable tag: 3.3.0 * Author: Team Razorpay * WC tested up to: 6.2.2 * Author URI: https://razorpay.com