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