Tagged: enfold, redirect, woocommerce
-
AuthorPosts
-
August 17, 2018 at 1:14 pm #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!Please advise me to fix this problem
Good Luck ;)August 17, 2018 at 1:29 pm #998427Hey 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,
DudeAugust 18, 2018 at 10:29 am #998672Hi,
Thanks for your guidanceHow to customize Breadcrumb?
I do not want to display the categories on the product page.Good Luck ;)
August 18, 2018 at 11:36 am #998691Hi!
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,
PeterAugust 18, 2018 at 12:43 pm #998696Hi,
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 );
August 18, 2018 at 4:50 pm #998726Hi!
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 -
AuthorPosts
- You must be logged in to reply to this topic.