Skip to content

Commit

Permalink
Merge pull request #300 from razorpay/woo-callback-redirect-issue
Browse files Browse the repository at this point in the history
Fixed the Woo-callback redirection issue for orders when added from admin dashboard.
  • Loading branch information
garimaprachi authored Jun 24, 2022
2 parents 58233f8 + 713149a commit dbf7c8c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions woo-razorpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -1123,15 +1123,20 @@ function check_razorpay_response()

rzpLogInfo("Called check_razorpay_response: $post_password");

$postData = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_status FROM $wpdb->posts AS P WHERE post_type=%s AND post_password = %s", $post_type, $post_password ) );

$arrayPost = json_decode(json_encode($postData), true);

if (!empty($arrayPost) && count($arrayPost[0]) > 0)
$meta_key = '_order_key';

$postMetaData = $wpdb->get_row( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta AS P WHERE meta_key = %s AND meta_value = %s", $meta_key, $post_password ) );

$postData = $wpdb->get_row( $wpdb->prepare("SELECT post_status FROM $wpdb->posts AS P WHERE post_type=%s and ID=%s", $post_type, $postMetaData->post_id) );

$arrayPost = json_decode(json_encode($postMetaData), true);

if (!empty($arrayPost) and
$arrayPost != null)
{
$orderId = $postData[0]->ID;
$orderId = $postMetaData->post_id;

if($postData[0]->post_status == 'draft')
if ($postData->post_status === 'draft')
{
updateOrderStatus($orderId, 'wc-pending');
}
Expand Down

0 comments on commit dbf7c8c

Please sign in to comment.