WooCommerce lost password reset flow not working with SendGrid (redirect loop)

If you’re using SendGrid to process emails from WooCommerce and have click tracking enabled, links that use $_GET vars will break. Sendgrid uses a URL sanitizer that converts the &id= to &id= and that creates an issue in WooCommerce…

The password reset form redirect looks for two get vars, $_GET['key'] and $_GET['id'], and if they’re not present, it won’t show the password reset form, just the standard “Please enter your username or email address.” form. It feels like a redirect loop but it’s because of a malformed URL ( PHP parses that get var as $_GET['amp;id'] ).

I didn’t realize the issue was coming from SendGrid, but after a ton of debugging and diving into WC’s source code I realized the conditional check was failing for seemingly no reason, and it was because the get var didn’t exist.

Easy Digital Downloads posted instructions to turn off SendGrid click tracking on their site in response to an EDD github issue and it works to solve this too.

Hope this helps!

Leave a Comment