Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #998417

    Hi,
    How to change url after logging out in woocommerce account ?
    I found the following solution but did not find the appropriate file for editing!

    WooCommerce – Redirect to a custom page after logging out

    Please advise me to fix this problem
    Good Luck ;)

    #998427

    Hey Sorinwd,

    Add this code to your child theme functions.php file:

    
    /**
     * Redirect user after successful login.
     *
     * @param string $redirect_to URL to redirect to.
     * @param string $request URL the user is coming from.
     * @param object $user Logged user's data.
     * @return string
     */
    
    function my_login_redirect( $redirect_to, $request, $user ) {
        //is there a user to check?
        if (isset($user->roles) && is_array($user->roles)) {
            //check for customers
            if (in_array('customer', $user->roles)) {
                // redirect them to another URL, in this case, the homepage 
                $redirect_to = 'https://mywebsite.com/customurl';
            }
        }
    
        return $redirect_to;
    }
    
    add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
    

    and replace https://mywebsite.com/customurl with the url where you want to redirect to.

    Best regards,
    Dude

    #998672

    Hi,
    Thanks for your guidance

    How to customize Breadcrumb?
    I do not want to display the categories on the product page.

    Good Luck ;)

    #998691

    Hi!

    Add this code to the functions.php or plugin file:

    
    add_filter( 'avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 50, 2 );
    function avia_breadcrumbs_trail_mod( $trail, $args ) 
    {
    	foreach ($trail as $key => $value)
    	{
    		if(strpos($value, '/product-category/') !== false)
    		{
    			unset($trail[$key]);
    		}
    	}
    	return $trail;
    }
    

    It will remove all breadcrumb links which contain the “product-category” slug in the url.

    Regards,
    Peter

    #998696

    Hi,
    If I want to redirect all users to the custom link, not just how do customers do it?

    function my_login_redirect( $redirect_to, $request, $user ) {
        //is there a user to check?
        if (isset($user->roles) && is_array($user->roles)) {
            //check for customers
            if (in_array('customer', $user->roles)) {
                // redirect them to another URL, in this case, the homepage 
                $redirect_to = 'https://mywebsite.com/customurl';
            }
        }
    
        return $redirect_to;
    }
    
    add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
    #998726

    Hi!

    Then you can use this code

    
    
    function my_login_redirect( $redirect_to, $request, $user ) {
        //is there a user to check?
        if (isset($user->roles) && is_array($user->roles)) {
            //check for customers
                // redirect them to another URL, in this case, the homepage 
                $redirect_to = 'https://mywebsite.com/customurl';
        }
    
        return $redirect_to;
    }
    
    add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
    

    Best regards,
    Peter

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.