Pay page fix
This commit is contained in:
parent
0d8039c4b3
commit
c29702ee6b
|
@ -40,15 +40,21 @@ function woocommerce_pay() {
|
|||
// Update payment method
|
||||
if ($order->order_total > 0 ) :
|
||||
$payment_method = woocommerce_clean($_POST['payment_method']);
|
||||
update_post_meta( $order_id, '_payment_method', $payment_method);
|
||||
|
||||
$available_gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
|
||||
|
||||
$result = $available_gateways[$payment_method]->process_payment( $order_id );
|
||||
|
||||
$available_gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
|
||||
|
||||
// Update meta
|
||||
update_post_meta( $order_id, '_payment_method', $payment_method);
|
||||
if (isset($available_gateways) && isset($available_gateways[$payment_method])) :
|
||||
$payment_method_title = $available_gateways[$payment_method]->title;
|
||||
endif;
|
||||
update_post_meta( $order_id, '_payment_method_title', $payment_method_title);
|
||||
|
||||
$result = $available_gateways[$payment_method]->process_payment( $order_id );
|
||||
|
||||
// Redirect to success/confirmation/payment page
|
||||
if ($result['result']=='success') :
|
||||
wp_safe_redirect( $result['redirect'] );
|
||||
wp_redirect( $result['redirect'] );
|
||||
exit;
|
||||
endif;
|
||||
else :
|
||||
|
|
Loading…
Reference in New Issue