Thread Starter
anonymized-17631918
(@anonymized-17631918)
Okay, i find out the bug:
https://yithemes.com/themes/plugins/yith-woocommerce-customize-myaccount-page/
If both plugins are installed, the normal Wishlist Site where is set in settings is not respected. There is every time a redirect to the “My Account” Page. This is very bad for Guests. Guests has no chance to use the Wishlist because they dont have an account.
Unprofessional Fix:
File: includes/class.yith-wcwl.php
Search for: yith_wcwl_wishlist_page_url
Comment this line out and write:
return 'https://mysite.com/mywishlist/';
Not nice but works without an error.
Thread Starter
anonymized-17631918
(@anonymized-17631918)
Better Version:
if ( is_user_logged_in() ) {
return apply_filters( 'yith_wcwl_wishlist_page_url', esc_url_raw( $base_url ), $action );
} else {
return 'https://mysite.com/wishlist/';
};
With this the Guests will be redirected to the “Guest Wishlist Page” and all logged in Users to the Wishlist Site in “My Account”.
Hi there
a better way of obtaining the same result, without altering any plugin file, is the following:
Just append this snippet of code at the end of functions.php file of your theme or child theme
if ( ! function_exists( 'yith_wcwl_stop_wcmap_redirect' ) ) {
function yith_wcwl_stop_wcmap_redirect() {
return is_user_logged_in();
}
add_filter( 'yith_wcmap_filter_wishlist_url', 'yith_wcwl_stop_wcmap_redirect', 10 );
}
This way, guests will be redirected to dedicated wishlist page, while logged-in users will be redirected to My Account endpoint
Thread Starter
anonymized-17631918
(@anonymized-17631918)
Thank You.
Much better. This is the reason why you are the Devs and i am not 🙂
You’re welcome!
If you enjoy our plugin, don’t forget to leave us a 5 star review, to support us and help our work
Thank you!