• Hi!
    I just noticed that when I click on the wishlist icon, it redirects me to the site /wishlist/view/ which causes a 404 error. The page /wishlist works fine. Is there a way to change the link?

    I tried saving the Permalinks and the error still shows.

    I am using Polylang on my website, so there might be a conflict with it? Not sure.

    I created a child theme of the theme I am using (eStore) and am not sure where to access/ change the functions.php to possibly change the link.

    Any help is appreciated, thank you.

    • This topic was modified 9 years, 6 months ago by sillyme727.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi sillyme727

    Could you please try to add the following code at the end of functions.php file of your theme or child?

    if ( defined( 'YITH_WCWL' ) && ! function_exists( 'yith_wcwl_change_polylang_wishlist_url' ) ) {
    	function yith_wcwl_change_polylang_wishlist_url( $url, $action = 'view' ) {
    		$wishlist_page_id = yith_wcwl_object_id( get_option( 'yith_wcwl_wishlist_page_id' ) );
    
    		$base_url = get_the_permalink( $wishlist_page_id );
    
    		if ( defined( 'POLYLANG_VERSION' ) && pll_current_language() != pll_default_language() ) {
    			$translated_page = pll_get_post( $wishlist_page_id );
    
    			if ( $translated_page ) {
    				$base_url = get_the_permalink( $translated_page );
    			}
    		}
    
    		$action_params = explode( '/', $action );
    		$params = array();
    
    		if ( isset( $action_params[1] ) ) {
    			$action = $action_params[0];
    			$params['wishlist-action'] = $action;
    
    			if ( $action == 'view' ) {
    				$params['wishlist_id'] = $action_params[1];
    			} elseif ( $action == 'user' ) {
    				$params['user_id'] = $action_params[1];
    			}
    		} else {
    			$params['wishlist-action'] = $action;
    		}
    
    		$base_url = add_query_arg( $params, $base_url );
    
    		return esc_url_raw( $base_url );
    	}
    
    	add_filter( 'yith_wcwl_wishlist_page_url', 'yith_wcwl_change_polylang_wishlist_url', 10, 2 );
    }

    This is a little wishlist – polylang integration I developed, that should force plugin using “query string” version of the url (?action=view&wishlist_id=SOMETHING)

    Please, let me know if this works as expected
    Have a nice day

    Thread Starter sillyme727

    (@sillyme727)

    Hi! Thank you so much for your response.
    I added the code to my functions.php and I got an error code and I could not access my dashboard anymore. The error code was as follows: Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) (in my functions.php in line 45)

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Side note to @vasilelazar Per the forum welcome please post your own topic.

    Taking over someone else’s old topic doesn’t help them and you’ll get better support if you start your own topic.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Yith Woocommerce Wishlist Button Link 404 Error’ is closed to new replies.