Closed (fixed)
Project:
Commerce Email
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
5 Jun 2020 at 16:44 UTC
Updated:
20 Feb 2024 at 08:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
rszrama commentedHmm, you're definitely interpreting the email event name properly, and the code seems to match up to the name of the core checkout event. Will try to reproduce in a vanilla environment, make sure there isn't something getting in the way.
Comment #3
rszrama commentedFor what it's worth, I just tested this locally and the email sent fine. However, it does require the customer to actually register on the checkout completion page. In Commerce 2.x, that requires them to create a username and password, and upon submitting the form, they are logged in and the event is fired. Can you confirm?
Comment #4
devnyc commentedAh - So I have the registration happen during the first checkout stage since we don’t allow guest checkout. I suppose I’d just need to modify the Checkout Completion example to fire on that stage of the checkout?
Thanks very much for checking it out.
Comment #5
rszrama commentedAhh, interesting. Let's just repurpose this issue as a feature request to add an EmailEvent specifically for registration during checkout as opposed to registration after checkout completion. When we dig into it, this will require a patch to Commerce core, because we don't currently have Events for login or registration during checkout.
No promises on timeline, unfortunately, but you can always hook into the new account creation process itself to fire off that email via custom code in the meantime.
Comment #6
rszrama commentedWe may also want to accommodate the new settings in Commerce 2.36 that support the automatic creation of a user account on checkout completion in this issue.
Comment #7
karengrey commentedCreated issue for Commerce Core to create the new Event for registration during checkout: https://www.drupal.org/project/commerce/issues/3388613
Comment #9
karengrey commentedOnce the Commerce Core issue has been committed, this MR will be unblocked and will add a new EmailEvent for registration during checkout.
Comment #10
vmarchuk@rszrama
Note that when the commerce_checkout.checkout_register event is fired, the order has not yet been placed. So, certain information such as [commerce_order:total_paid] will not be available yet.
This is because in extractEntityFromEvent() we return the order but not the account that was just created. But in this case, we can get the account from the order [commerce_order:uid:entity] and also use some information available for the order. If we return the account, we will not be able to access the order information.
But it looks like the purpose of this issue is to work with the account, so probably we shouldn't think about the order and just return the account in extractEntityFromEvent()? And the order in the extractRelatedEntitiesFromEvent()?
Comment #12
vmarchukCommitted!