Redirect to current page on Woocommerce logout?
-
I’d like for Woocommerce users who logout (via a logout link in the nav menu) to be redirected to whatever page they are currently on (and if they logout from any My Account type page, they should get sent back to the homepage).
The logout link that seems to get used in Woocommerce:
$logout_link = esc_url( wc_get_endpoint_url( 'customer-logout', '', wc_get_page_permalink( 'myaccount' ) ) );
Can’t figure out how to make this redirect. I found this thread on the old Woo forums that addresses this, but this seems to have been overtaken by recent updates in Woocommerce.
If I use the good ol’
wp_logout_url( get_permalink() );
instead this seems to work as I want. I’m just wondering if I’m missing some unintended consequence by not using the wc_get_endpoint way of doing this.
- The topic ‘Redirect to current page on Woocommerce logout?’ is closed to new replies.