Skip to content

Commit

Permalink
Merge pull request #209 from razorpay/order_number_fix
Browse files Browse the repository at this point in the history
Fix for the custom woocommerce order id issue
  • Loading branch information
ChetanGN authored Nov 16, 2021
2 parents c7ce74c + c5c1dda commit a3df6bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
6 changes: 5 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.7.2
Stable tag: 2.8.0
Stable tag: 2.8.1
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,10 @@ This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has

== Changelog ==

= 2.8.1 =
* Bug fix in custom woocommerce order number issue.
* Tested up to Woocommerce 5.9.0

= 2.8.0 =
* Added Route module to split payments and transfer funds to Linked accounts.
* Tested up to Woocommerce 5.8.0
Expand Down
20 changes: 13 additions & 7 deletions woo-razorpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Plugin Name: Razorpay for WooCommerce
* Plugin URI: https://razorpay.com
* Description: Razorpay Payment Gateway Integration for WooCommerce
* Version: 2.8.0
* Stable tag: 2.8.0
* Version: 2.8.1
* Stable tag: 2.8.1
* Author: Team Razorpay
* WC tested up to: 5.8.0
* WC tested up to: 5.9.0
* Author URI: https://razorpay.com
*/

Expand Down Expand Up @@ -586,7 +586,9 @@ private function getDefaultCheckoutArguments($order)

$orderId = $order->get_order_number();

$callbackUrl = $this->getRedirectUrl($orderId);
$wcOrderId = $order->get_id();

$callbackUrl = $this->getRedirectUrl($wcOrderId);

$sessionKey = $this->getOrderSessionKey($orderId);
$razorpayOrderId = get_transient($sessionKey);
Expand All @@ -599,7 +601,8 @@ private function getDefaultCheckoutArguments($order)
'currency' => self::INR,
'description' => $productinfo,
'notes' => array(
self::WC_ORDER_ID => $orderId
self::WC_ORDER_ID => $orderId,
self::WC_ORDER_NUMBER => $wcOrderId
),
'order_id' => $razorpayOrderId,
'callback_url' => $callbackUrl,
Expand Down Expand Up @@ -819,7 +822,7 @@ function generateOrderForm($data)
{
$data["_"] = $this->getVersionMetaInfo($data);

$wooOrderId = $data['notes']['woocommerce_order_id'];
$wooOrderId = $data['notes']['woocommerce_order_number'];

$redirectUrl = $this->getRedirectUrl($wooOrderId);

Expand Down Expand Up @@ -1116,7 +1119,10 @@ public function updateOrder(& $order, $success, $errorMessage, $razorpayPaymentI
if($this->getSetting('route_enable') == 'yes')
{
$razorpayRoute = new RZP_Route_Action();
$razorpayRoute->transferFromPayment($orderId, $razorpayPaymentId); // creates transfers from payment

$wcOrderId = $order->get_id();

$razorpayRoute->transferFromPayment($wcOrderId, $razorpayPaymentId); // creates transfers from payment
}

if($virtualAccountId != null)
Expand Down

0 comments on commit a3df6bb

Please sign in to comment.