P
P
Pavel2015-09-25 16:14:21
CMS
Pavel, 2015-09-25 16:14:21

How to redirect the user to a specific page after submitting an order in Woocommerce?

I looked through all the settings in the admin panel, I also did not find anything in Google. I may not be looking. The thing is obvious. How can I direct the user to the page I need after placing an order?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WP Panda, 2015-09-27
@Palych_tw

Can you do it like this

add_action( 'template_redirect', 'my_checkout_redirect' ); 
function my_checkout_redirect() {
  global $wp;
  
  if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
    wp_redirect( '%my_custom_url%' );
    exit;
  }
}

If you write your payment gateway, you need to do this
Lines 15-18

A
Alexander Belokamensky, 2015-09-26
@surgeon88

On some "payment" gateways there is a field where to redirect after payment

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question