[4.x]: Activation email not sent when existing pending user submits `registerUserOnOrderComplete`
What happened?
I have a question/feedback about user registration on checkout.
Say we have a customer that has previously chosen not to register, so at some point in the past a user was created is in 'Pending' status (or more likely, they were a Customer in Commerce 3 and became a pending user during the Commerce 4 migration, I guess)
They now go through checkout again, but this time they do choose to register (so registerUserOnOrderComplete is true on the order)(...we show them this option as they are not a credentialed user).
...what actually happens?
I'd expect/want the user activation email to be sent at this point (even if e.g. they've been sent one before but ignored it) - but that seems not to be the case (as reported by a customer just now).
Basically, I'd have thought that if they choose to register on checkout, that activation email would be sent in all cases unless they are already a credentialed user (or I guess suspended).
But....apparently not?
Craft CMS version
Craft Pro 4.4.16.1
Craft Commerce version
4.2.11
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
@bossanova808 Just looked into this, and it looks like it's working as expected. The user should receive an email if they are not already credentialed.
It sounds like your user/customer is already credentialed, so we don’t attempt to create a user and send the activation email if they already have an account that needs activation.
This is the same behaviour if a user registers outside of commerce and doesn't click their activation email. They would not be able to register with that email from the front-end.
I will discuss this with the Craft CMS team.
As for this:
(or more likely, they were a Customer in Commerce 3 and became a pending user during the Commerce 4 migration, I guess)
In the commerce 3 -> 4 migration we create the user as inactive (not credentialed) and they should be able to use the register on order complete process and get an email.
Thanks Luke.
This customer was definitely in a state of Pending. I guess this means that perhaps he had previously ticked the register account box, but not followed through. And I suppose that's the key question...what should happen in that case.
He clicked the 'register account' box we provide on checkout, and the activation email was definitely not then sent (I checked our Postmark email logs to be sure). So that is the specific path I am trying to diagnose.
Just to be clear, I'd interpret 'credentialed' as user who has actually set a password. This was not the case here (according to his memory, anyhow, and confirmed via the control panel and that Pending status...he is an old customer that has popped back up after a few years away).
So it was confusing to him that he did not get an activation email on this checkout.
Is the idea, then, that existing Pending users who do not click that initial activation email, can only proceed with their account by using a password reset procedure (which I'd argue is confusing - given they have not set a password at any point, so they would logically not really think of resetting anything given they've never set in the first place, would they? (I know we can also manually re-send the activation email too, of course).
I'm not sure I can see a good reason why the behaviour of Inactive vs Pending should be different with this specific scenario, to be honest.
In our case we actually have more pending users than inactive ones, I guess collected over the years from people not following through with setting up their account. But I'd assume it's not uncommon for one of them to come back and want to become full, credentialed users at some point.
I could write something that converts these Pending users back to Inactive, I guess? But I am just not really understanding why there's a difference in behaviour here, really, in the context of Commerce at least. Like:
This is the same behaviour if a user registers outside of commerce and doesn't click their activation email. They would not be able to register with that email from the front-end.
...that just doesn't make sense to me, really. Why prevent them from getting another activation email? What's the gain there? I'm probably missing something, but I'd have thought each time they express a wish to join, the system should give them the opportunity.
Just found this buried in my 'still to be resolved' area - where did you folks get with your discussions on this?
Will have another discussion about this tonight, and get back to you. Thanks.
We have made a fix for this in the next release.
To get the fix early, change your craftcms/commerce requirement in composer.json to:
"require": {
"craftcms/commerce": "5.x-dev#9cc11a6d086646105d51751f717b2b022aff5b55",
"...": "..."
}
Then run composer update.
We will update this ticket once the release is out.
5.0.14 and 4.6.7 are now both out and fix this issue. Pending users who opt-in at any time to register on order completion will get another activation email.