Viewing 5 replies - 1 through 5 (of 5 total)
  • Same problem, plugin dont use new endpoints

    Hy,

    Sorry for my poor english. I have solved that problem changing a piece of code in file “woocommerce-custom-payment-gateways.php” on line 121. I have deleted this lines of codes:

    /********** DELETE ************/
    return array(
    ‘result’ => ‘success’,
    ‘redirect’ => add_query_arg(‘key’, $order->order_key, add_query_arg(‘order’, $order_id, get_permalink(woocommerce_get_page_id(‘thanks’))))
    /***********DELETE END************/

    and i have included in the same place this code:

    /*********** INSERT ************/
    // Empty the Cart
    WC()->cart->empty_cart();

    // Get redirect
    $return_url = $order->get_checkout_order_received_url();

    // Redirect to success/confirmation/payment page
    if ( is_ajax() ) {
    echo ‘<!–WC_START–>’ . json_encode(
    array(
    ‘result’ => ‘success’,
    ‘redirect’ => apply_filters( ‘woocommerce_checkout_no_payment_needed_redirect’, $return_url, $order )
    )
    ) . ‘<!–WC_END–>’;
    exit;
    } else {
    wp_safe_redirect(
    apply_filters( ‘woocommerce_checkout_no_payment_needed_redirect’, $return_url, $order )
    );
    exit;
    }
    // Redirect to success/confirmation/payment page
    if ( $result[‘result’] == ‘success’ ) {

    $result = apply_filters( ‘woocommerce_payment_successful_result’, $result, $order_id );

    if ( is_ajax() ) {
    echo ‘<!–WC_START–>’ . json_encode( $result ) . ‘<!–WC_END–>’;
    exit;
    } else {
    wp_redirect( $result[‘redirect’] );
    exit;
    }

    }
    /*********** INSERT END*************/

    Hope you help.
    By

    inakigil, Thank you, brother.
    Very much helped me.

    this is just leaving a blank white screen for me.

    line 122

    //return array(			'result' 	=> 'success',			'redirect'	=> add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(woocommerce_get_page_id('thanks'))))		);	}

    then added

    // Empty the Cart
    	WC()->cart->empty_cart();
    
    	// Get redirect
    	$return_url = $order->get_checkout_order_received_url();
    
    	// Redirect to success/confirmation/payment page
    	if ( is_ajax() ) {
    		echo '<!--WC_START-->' . json_encode(
    			array(
    			'result' => 'success',
    			'redirect' => apply_filters( 'woocommerce_checkout_no_payment_needed_redirect', $return_url, $order )
    			)
    		) . '<!--WC_END-->';
    		exit;
    	} else {
    		wp_safe_redirect(
    		apply_filters( 'woocommerce_checkout_no_payment_needed_redirect', $return_url, $order )
    		);
    		exit;
    	}
    	// Redirect to success/confirmation/payment page
    	if ( $result['result'] == 'success' ) {
    
    		$result = apply_filters( 'woocommerce_payment_successful_result', $result, $order_id );
    
    		if ( is_ajax() ) {
    			echo '<!--WC_START-->' . json_encode( $result ) . '<!--WC_END-->';
    			exit;
    		} else {
    			wp_redirect( $result['redirect'] );
    			exit;
    		}
    
    	}

    And I just fixed it lol

    // Return thankyou redirect
    				//return array(			'result' 	=> 'success',			'redirect'	=> add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(woocommerce_get_page_id('thanks'))))		);	
    
    // Empty the Cart
    	WC()->cart->empty_cart();
    
    	// Get redirect
    	$return_url = $order->get_checkout_order_received_url();
    
    	// Redirect to success/confirmation/payment page
    	if ( is_ajax() ) {
    		echo '<!--WC_START-->' . json_encode(
    			array(
    			'result' => 'success',
    			'redirect' => apply_filters( 'woocommerce_checkout_no_payment_needed_redirect', $return_url, $order )
    			)
    		) . '<!--WC_END-->';
    		exit;
    	} else {
    		wp_safe_redirect(
    		apply_filters( 'woocommerce_checkout_no_payment_needed_redirect', $return_url, $order )
    		);
    		exit;
    	}
    	// Redirect to success/confirmation/payment page
    	if ( $result['result'] == 'success' ) {
    
    		$result = apply_filters( 'woocommerce_payment_successful_result', $result, $order_id );
    
    		if ( is_ajax() ) {
    			echo '<!--WC_START-->' . json_encode( $result ) . '<!--WC_END-->';
    			exit;
    		} else {
    			wp_redirect( $result['redirect'] );
    			exit;
    		}
    
    	}
    	}

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘This plugin empty the cart after the end the order’ is closed to new replies.