Skip to content

Commit

Permalink
Merge pull request #258 from razorpay/1cc-remove-cod-int
Browse files Browse the repository at this point in the history
[PLG-97] Removed COD intelligence config from wc dashboard and removed force C…
  • Loading branch information
ChetanGN authored Apr 21, 2022
2 parents 51f06dc + 4daacaa commit 8c70c85
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 21 deletions.
7 changes: 0 additions & 7 deletions includes/api/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion includes/api/coupon-apply.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', []);
Expand Down
10 changes: 2 additions & 8 deletions includes/api/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion includes/api/shipping-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions woo-razorpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 8c70c85

Please sign in to comment.