Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter tkwpweb

    (@tkwpweb)

    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 tkwpweb

    (@tkwpweb)

    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”.

    Plugin Author YITHEMES

    (@yithemes)

    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 tkwpweb

    (@tkwpweb)

    Thank You.

    Much better. This is the reason why you are the Devs and i am not ??

    Plugin Author YITHEMES

    (@yithemes)

    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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Redirection Bug’ is closed to new replies.