Razorpay for WooCommerce - Version 3.4.0

Version Description

  • Bug fix for magic checkout blank orders.
Download this release

Release Info

Developer razorpay
Plugin Icon 128x128 Razorpay for WooCommerce
Version 3.4.0
Comparing to
See all releases

Code changes from version 3.3.0 to 3.4.0

includes/api/api.php CHANGED
@@ -80,7 +80,7 @@ function rzp1ccInitRestApi()
80
 
81
  // save abandoned cart data
82
  register_rest_route(
83
- RZP_1CC_ROUTES_BASE . '/',
84
  'abandoned-cart',
85
  array(
86
  'methods' => 'POST',
80
 
81
  // save abandoned cart data
82
  register_rest_route(
83
+ RZP_1CC_ROUTES_BASE,
84
  'abandoned-cart',
85
  array(
86
  'methods' => 'POST',
includes/api/order.php CHANGED
@@ -95,6 +95,8 @@ function createWcOrder(WP_REST_Request $request)
95
  if (is_wp_error($orderId)) {
96
  $checkout_error = $orderId->get_error_message();
97
  }
 
 
98
  } else {
99
  $existingOrder = wc_get_order($orderIdFromHash);
100
  $existingOrder->calculate_totals();
@@ -107,6 +109,8 @@ function createWcOrder(WP_REST_Request $request)
107
  if (is_wp_error($orderId)) {
108
  $checkout_error = $orderId->get_error_message();
109
  }
 
 
110
  } else {
111
  $orderId = $woocommerce->session->get(RZP_1CC_CART_HASH . $cartHash);
112
  }
@@ -117,7 +121,7 @@ function createWcOrder(WP_REST_Request $request)
117
  if ($order) {
118
 
119
  // To remove coupon added on order.
120
- $coupons = $order->get_used_coupons();
121
  if (!empty($coupons)) {
122
  foreach ($coupons as $coupon) {
123
  $order->remove_coupon($coupon);
@@ -239,3 +243,12 @@ function createWcOrder(WP_REST_Request $request)
239
  return new WP_REST_Response($response, 400);
240
  }
241
  }
 
 
 
 
 
 
 
 
 
95
  if (is_wp_error($orderId)) {
96
  $checkout_error = $orderId->get_error_message();
97
  }
98
+ //Keep order in draft status untill customer info available
99
+ updateOrderStatus($orderId, 'draft');
100
  } else {
101
  $existingOrder = wc_get_order($orderIdFromHash);
102
  $existingOrder->calculate_totals();
109
  if (is_wp_error($orderId)) {
110
  $checkout_error = $orderId->get_error_message();
111
  }
112
+ //Keep order in draft status untill customer info available
113
+ updateOrderStatus($orderId, 'draft');
114
  } else {
115
  $orderId = $woocommerce->session->get(RZP_1CC_CART_HASH . $cartHash);
116
  }
121
  if ($order) {
122
 
123
  // To remove coupon added on order.
124
+ $coupons = $order->get_coupon_codes();
125
  if (!empty($coupons)) {
126
  foreach ($coupons as $coupon) {
127
  $order->remove_coupon($coupon);
243
  return new WP_REST_Response($response, 400);
244
  }
245
  }
246
+
247
+ //Update order status according to the steps.
248
+ function updateOrderStatus($orderId, $orderStatus)
249
+ {
250
+ wp_update_post(array(
251
+ 'ID' => $orderId,
252
+ 'post_status' => $orderStatus,
253
+ ));
254
+ }
includes/api/save-abandonment-data.php CHANGED
@@ -35,6 +35,11 @@ function saveCartAbandonmentData(WP_REST_Request $request)
35
  if (isset($razorpayData['receipt'])) {
36
  $wcOrderId = $razorpayData['receipt'];
37
 
 
 
 
 
 
38
  $order = wc_get_order($wcOrderId);
39
  }
40
 
35
  if (isset($razorpayData['receipt'])) {
36
  $wcOrderId = $razorpayData['receipt'];
37
 
38
+ if (isset($razorpayData['customer_details']['shipping_address'])) {
39
+ //Update the order status to wc-pending as we have the customer address info at this point.
40
+ updateOrderStatus($wcOrderId, 'wc-pending');
41
+
42
+ }
43
  $order = wc_get_order($wcOrderId);
44
  }
45
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: razorpay
3
  Tags: razorpay, payments, india, woocommerce, ecommerce
4
  Requires at least: 3.9.2
5
  Tested up to: 5.9
6
- Stable tag: 3.3.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  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
41
 
42
  == Changelog ==
43
 
 
 
 
44
  = 3.3.0 =
45
  * Magic checkout COD intelligence config moved from wooc dashboard to razorpay dashboard.
46
 
@@ -276,6 +279,12 @@ Yes, please see https://github.com/razorpay/razorpay-woocommerce/wiki/Webhooks f
276
  Please get multi-currency enabled for your account. Once you have it enabled, you can install any plugin
277
  version higher than 2.0.0, which comes with native multi-currency support.
278
 
 
 
 
 
 
 
279
  == Support ==
280
 
281
  Visit [razorpay.com](https://razorpay.com/support/#request/merchant/technical-assistance) for support requests.
3
  Tags: razorpay, payments, india, woocommerce, ecommerce
4
  Requires at least: 3.9.2
5
  Tested up to: 5.9
6
+ Stable tag: 3.4.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
41
 
42
  == Changelog ==
43
 
44
+ = 3.4.0 =
45
+ * Bug fix for magic checkout blank orders.
46
+
47
  = 3.3.0 =
48
  * Magic checkout COD intelligence config moved from wooc dashboard to razorpay dashboard.
49
 
279
  Please get multi-currency enabled for your account. Once you have it enabled, you can install any plugin
280
  version higher than 2.0.0, which comes with native multi-currency support.
281
 
282
+ = How can I exclude Draft orders from woocommerce analytics reports? =
283
+
284
+ Please follow the below steps:
285
+ 1. Click on the ‘Analytics’ settings in the WooCommerce dashboard menu.
286
+ 2. Go to the ‘Excluded statuses’ section and select the checkbox for ‘Draft’ orders under the ‘Unregistered statuses’ section.
287
+
288
  == Support ==
289
 
290
  Visit [razorpay.com](https://razorpay.com/support/#request/merchant/technical-assistance) for support requests.
woo-razorpay.php CHANGED
@@ -3,8 +3,8 @@
3
  * Plugin Name: Razorpay for WooCommerce
4
  * Plugin URI: https://razorpay.com
5
  * Description: Razorpay Payment Gateway Integration for WooCommerce
6
- * Version: 3.3.0
7
- * Stable tag: 3.3.0
8
  * Author: Team Razorpay
9
  * WC tested up to: 6.2.2
10
  * Author URI: https://razorpay.com
@@ -1102,6 +1102,9 @@ EOT;
1102
  if (count($postIds) > 0)
1103
  {
1104
  $orderId = $postIds[0];
 
 
 
1105
  $order = wc_get_order($orderId);
1106
  rzpLogInfo("get_transient in check_razorpay_response: orderId $orderId");
1107
  }
@@ -1188,7 +1191,7 @@ EOT;
1188
  $razorpayOrderId = get_transient($sessionKey);
1189
  $razorpayData = $api->order->fetch($razorpayOrderId);
1190
 
1191
- $this->updateOrderAddress($razorpayData['items'][0], $order);
1192
  }
1193
 
1194
  $this->handleErrorCase($order);
3
  * Plugin Name: Razorpay for WooCommerce
4
  * Plugin URI: https://razorpay.com
5
  * Description: Razorpay Payment Gateway Integration for WooCommerce
6
+ * Version: 3.4.0
7
+ * Stable tag: 3.4.0
8
  * Author: Team Razorpay
9
  * WC tested up to: 6.2.2
10
  * Author URI: https://razorpay.com
1102
  if (count($postIds) > 0)
1103
  {
1104
  $orderId = $postIds[0];
1105
+
1106
+ updateOrderStatus($orderId, 'wc-pending');
1107
+
1108
  $order = wc_get_order($orderId);
1109
  rzpLogInfo("get_transient in check_razorpay_response: orderId $orderId");
1110
  }
1191
  $razorpayOrderId = get_transient($sessionKey);
1192
  $razorpayData = $api->order->fetch($razorpayOrderId);
1193
 
1194
+ $this->updateOrderAddress($razorpayData, $order);
1195
  }
1196
 
1197
  $this->handleErrorCase($order);