Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sut3kh created an issue. See original summary.

Sut3kh’s picture

Patch is based on #2857157-91: Implement registration after guest checkout which is hopefully looking to be stable enough to review this now.

Status: Needs review » Needs work
Sut3kh’s picture

whoops, fixed patch

greggles’s picture

Do I understand it right:

* #2907605: Commerce 2 Login checkout pane will allow existing users to log in with their email address during checkout.
* This issue will allow a user who is checking out as a guest to register with their email (and not a username)

Thanks for your work on this! Can you perhaps review #2907605: Commerce 2 Login checkout pane as well?

andypost’s picture

Status: Needs review » Needs work

I did commit #2907605: Commerce 2 Login checkout pane
Meanwhile this patch needs a bit of polishing for codestyling

+++ b/src/Plugin/Commerce/CheckoutPane/EmailRegistrationCompletionRegistration.php
@@ -0,0 +1,52 @@
+class EmailRegistrationCompletionRegistration extends CompletionRegistration {
+  ¶
...
+      ¶
+      // Try and help password managers.
...
+    return $pane_form;
+  }
+  ¶
+}

trailing whitespaces

Sut3kh’s picture

Thanks @andypost, fixed the whitespace (and the dumb setting in phpstorm that caused it).

@greggles That's correct, it just avoids asking them to enter a username (as per the modifications to the normal user registration form).

jnrfred’s picture

Tested this patch and it works. I was able to create account with the email provided after checkout.

One thing that was done in this patch #2857157: Implement registration after guest checkout is The text 'You can optionally create an account at the end.' in the login checkout pane is only displayed when the registration pane is enabled so we need to find a way to display same text if email registration pane enabled. Currently, it will only show Proceed to checkout.

Apart from that this patch works.

jnrfred’s picture

Status: Needs review » Reviewed & tested by the community
andypost’s picture

need to find a way to display same text if email registration pane enabled.

Does it makes sense to create new issue or could be fixed here?

Anybody’s picture

Wouldn't it be better to replace / override the form from #2857157: Implement registration after guest checkout or add an option there instead of adding a further checkout pane based on it (by extends)?
I guess that would be easier to understand for users. Does it even make sense to give them the choice which pane to use?

Anybody’s picture

Status: Reviewed & tested by the community » Needs work

I guess we should also test this combined with #3016156: Multiple issues with Commerce 2 login checkout pane?

andypost’s picture

@Anybody not sure it is duplicate but needs someone using commerce to explain which implementation more useful

MegaChriz’s picture

@Anybody, @andypost
#3016156: Multiple issues with Commerce 2 login checkout pane is a different issue: that one is about fixing issues for the login checkout pane, shown at the beginning of the checkout process. This issue is about adding a registration checkout pane, shown at the end of the checkout process.

Looking at the code in this issue, a form alter instead of a new checkout pane looks like that would work as well. Extending an other pane only needs to be done if you need to override other methods from it that cannot easily be overridden by a form alter. I think a good case for extending an other pane is when you need to alter the output of ::buildPaneSummary().

Anybody’s picture

Thank you for the clarification, MegaChriz!
So we should decide here, if we need to rewrite the patch and alter the form OR keep the extension logic from #11. What do you both think?

Anway the patch might need some tests so I'll keep this at "Needs work".

Just as a side note, because I think you may often want to hide the user name input entirely when using email address instead: I created an issue at the Real Name module for that, because it doesn't have an integration with the commerce steps yet. Perhaps we should also keep that in mind / update that issue afterwards, because these issues may interfer with the form fields: #3016635: Provide integration with Drupal Commerce checkout registration

bohemier’s picture

I think the commerce checkout pane should also generate the same username as normal registration. Currently, if someone registers as thisIsMyEmail@gmail.com their username endsup being thisIsMyEmail. But registering on the commerce pane with the same email address renders the whole email address as username instead.

Sut3kh’s picture

I agree it would be better in a form alter so it 'just works' with the standard pane when the module is enabled, as per other forms.

Unfortunately I don't have time to further this at the moment, just thought I would share our re-roll of #7 to the final committed version of #2857157: Implement registration after guest checkout in case anyone else is already using the previous patch.

@bohemier this just replicates the standard email_registration user register form alter. Based on that, it looks like you could should be able to provide your own hook_email_registration_name() to keep the email address as the username.

lkacenja’s picture

It seems like whatever the outcome of this and #3016156: Multiple issues with Commerce 2 login checkout pane they should take the same approach. While I tend to think a form alter based approach has some benefits over two new checkout panes, I think they are pretty far down that path with the login form. Should there be conversation about the way both of these issues are being approached or should we just stick with the checkout pane for registration as well?

andypost’s picture

@lkacenja that's why 2 issues to get "pro&con" of both... commerce is evolving and drop as well
One day we could get #286401: Make email not required for a Drupal site account commited

greggles’s picture

@andypost - which do you prefer? Or what do you see as the pros/cons? @lkacenja can work on either solution, but is looking for direction. I don't have a preference.

andypost’s picture

@greggles Meanwhile I have no projects using this integrations, so prefer to collect opinions from real life

lkacenja’s picture

To update, it sounds like we are moving in the plugin direction. The login form issue should be resolved soon. I will create an issue to address #8 from this thread. Then hopefully, we can get this one rolled out as well!

lkacenja’s picture

Status: Needs work » Reviewed & tested by the community

I realized #8 will need to be a separate issue. The change to the login pane needs to happen after this pane is committed. I reviewed and tested this #17. I was able to register accounts as advertised. It's also consistent with the approach taken on the login pane. There is a very minor style issue with the buildPaneForm signature. I think those parameters should go on the same line. Seems great to me.

greggles’s picture

Fixing up credit.

  • greggles committed cea92ec on 8.x-1.x authored by Sut3kh
    Issue #2987060 by Sut3kh, andypost, greggles, Anybody, lkacenja, jnrfred...
greggles’s picture

Status: Reviewed & tested by the community » Fixed

OK, committed and pushed. Thanks for all the code, reviews, discussion and thoughts on this issue.

greggles’s picture

Folks interested in this issue may also want to look at #3081857: Login checkout pane should show guest checkout greeting message.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.