Login Redirect for WooCommerce
Building better MyListing websites. One code snippet at a time.
Overview
The Login Redirect for WooCommerce code snippet allows for greater flexibility within a MyListing website.
Out of the box, WooCommerce redirects users to their Dashboard (i.e. My Account), which may not be desirable for website owners.
Implementation
- Grab the code snippet.
- Follow the provided instructions.
- Save your changes.
//// INSTRUCTIONS:
//// Copy and paste the code snippet below into the child theme's functions.php file.
//// You can edit the functions.php file from your WordPress dashboard (Appearance > Theme Editor) or via FTP.
//// NOTES:
//// Adjust the website URL in line 14.
--------------------------- CODE SNIPPET IS BELOW THIS LINE ---------------------------
// LOGIN REDIRECT FOR WOOCOMMERCE
add_filter("woocommerce_login_redirect", "wc_login_redirect");
function wc_login_redirect($redirect_to) {
$redirect_to = "https://yourwebsite.com/";
return $redirect_to;
}