I want to redirect to custom page after purchase on woocommerce 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( get_page_by_title( About )->ID );
exit;
}
}
It redirects to 'order-received' page which does not exist.