Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

David Klotz
David Klotz
19,659 Points

woocommerce + wordpress redirect conflict

I've run into a conflict that occures between woocommerce and the wordpress login screen. When woocommerce is activated, the "forgot password?" links don't redirect to the forgot password page. Instead the link reloads the login page. If I deactivate woocommerce, the links work again. It also is causing conflicts with requiring users to be logged in to view the site (setting the site to be private). If I login a subscriber account it takes me to the account page rather than the homepage. Has anyone run into this issue or know of any solutions. What I'm trying to achieve with the site is for it to be a private site with the woocommerce shop. A user must have a login to view the site.

2 Answers

David Klotz
David Klotz
19,659 Points

Managed to solve this problem, for anyone that runs into the same issue here is my solution:

Set WordPress Login as Home Page with the plugin "members" https://wordpress.org/plugins/members/

Redirect WooCommerce login from "my account" to "home page". https://support.woothemes.com/hc/en-us/articles/202562649-Redirect-to-a-custom-page-after-logging-in-based-on-the-user-role

...combined with this plugin, the above code wouldn't override it alone, and neither would the plugin alone: https://wordpress.org/plugins/jonimo-simple-redirect/

Reset the forgot password URL from WooCommerce to WordPress. Because you have to be logged in to view the site, the forgot password was unable to access the WooCommerce Page. Adding this to functions.php resets the password url to the WordPress url.

// Wordpress + WooCommerce Reset Password URL function reset_pass_url() { $siteURL = get_option('siteurl'); return "{$siteURL}/wp-login.php?action=lostpassword"; } add_filter( 'lostpassword_url', 'reset_pass_url', 11, 0 );

jason chan
jason chan
31,009 Points

http://docs.woothemes.com/document/roles-capabilities/

documentation is your best friend. If not email woocommerce themselves.

David Klotz
David Klotz
19,659 Points

Thanks Jason for the response and advice! This got me headed in the right direction.