Redirect to My Account page after checkout

Please use this code in your wplms-customizer.php file in your wplms customizer plugin.

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( get_permalink( get_option('woocommerce_myaccount_page_id') ) );
    exit;
  }
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *