Givewp: With Give activated, Purchasing and creating an account with WooCommerce forces the customer login after purchase

Created on 19 Dec 2017  路  8Comments  路  Source: impress-org/givewp

Issue Overview

With Give activated, Purchasing and creating an account with WooCommerce forces the customer login after purchase

Expected Behavior

WooCommerce customer flow should not be impacted by Give in any way.

Current Behavior

If you have Give activated and WooCommerce, then when purchasing and creating an account, the customer is automatically logged in after purchase. This is not the default behavior of WooCommerce, customers.

Steps to Reproduce (for bugs)

  1. Enable WooCommerce (version 3.5.6) with Dummy Data provided in the plugin
  2. Do a checkout and notice that the customer is NOT logged in.
  3. Activate Give (1.8.17) and do another checkout. Note that you ARE logged in automatically.

Note that I also attempted to disable the Give autologin function via the filter provided:

add_filter('give_log_user_in_on_register', 'give_dont_auto_login');

function give_dont_auto_login() {
    return false;
}

This filter works as expected for Give forms, but has no impact on the WooCommerce autologin described above.

Most helpful comment

Resolved:

See the code issue via my video here: https://goo.gl/BTf7pv

I realized I didn't explain _why_ we need these two filters in our plugin so I made another video explaining that here: https://goo.gl/6CBLRi

All 8 comments

Recommended Debugging Steps

  1. With Xdebug activated, insert a breakpoint at this line.
  2. Complete the Steps to Reproduce above.
  3. When the breakpoint triggers, review the stack trace to see what caused the login.

@DevinWalker @mathetos @kevinwhoffman I've investigated more into the issue and created a video.
https://drive.google.com/open?id=1Quxk4lDq-kmNzvYmvxit8amRSXGx4w_y

Let me know your thoughts.

Nice Video and Finding @mehul0810

Totaly agreed with you
One thing we should hide the admin bar tools too in Give Core When the user has Give Donor Role

I'm not so sure we should hide the admin bar. Why does Woo hide it anyways?

@DevinWalker It's not about hiding the Admin bar, it's that Woo customers are NOT auto-logged-in after purchase. But when Give is active they ARE logged in. That shouldn't happen.

EDIT: I missed @mehul0810 's video above. I understand now what he's saying. We shouldn't touch the admin bar visibility in any way IMHO.

I don't know, in my tests, I was still logged in after purchase without Give active, I just was not able to see the black bar, and wp-admin redirected to my-account on the front end.

I tested again, and inspected the dom after purchase with Give NOT activated. I believe that WooCommerce is NOT logging their customers in, but similarly to our "Guest Donations" feature, they are showing that information based on sessions, not an actual login. So the issue still remains that Woo does NOT log their customers in, but when Give is active they DO get logged in.

I think it's worth inspecting the Give functions that do the auto-login to ensure we're not stepping on the toes of other popular plugins.

Resolved:

See the code issue via my video here: https://goo.gl/BTf7pv

I realized I didn't explain _why_ we need these two filters in our plugin so I made another video explaining that here: https://goo.gl/6CBLRi

Was this page helpful?
0 / 5 - 0 ratings

Related issues

henryholtgeerts picture henryholtgeerts  路  3Comments

samsmith89 picture samsmith89  路  3Comments

DevinWalker picture DevinWalker  路  3Comments

DevinWalker picture DevinWalker  路  3Comments

ravinderk picture ravinderk  路  4Comments