Victor Sokoliuk
Victor Sokoliuk

Reputation: 445

Woocommerce thankyou page is not working after checkout

Today I ran into an interesting issue. After payment thankyou page is not displayed. There is only white screen with menu. You can see it in the screenshot. thankyou page http://prntscr.com/ofpnuu I tried to create a custom thankyou page and tried to redirect it from the function.php but nothing happened. Then I installed the plugin to create thankyou page but again nothing happened. I have run out of ideas. Can someone tell me how to solve this issue.

Upvotes: 0

Views: 5758

Answers (1)

Shashi Singh
Shashi Singh

Reputation: 54

Use the hook below to redirect to the thank you page. Create a thank you page and redirect to that url...

Check the code below:

add_action( 'template_redirect', 'wc_custom_redirect_after_purchase' ); 
function wc_custom_redirect_after_purchase() { 
  global $wp;
  if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
    wp_redirect( 'http://www.yoururl.com/your-page/' );
    exit;
  }
}

Upvotes: 1

Related Questions