- Issue created by @jrochate
- ๐น๐ทTurkey rgnyldz
I can confirm this. The user is anonymous if the website has Guest checkout enabled and user choses to checkout as guest. Thus no user related info is visible inside the mail like [commerce_order:uuid:value] , [current-user:display-name] or[commerce_order:billing_profile]
After loging in with the same user (password reset) and make a new order, all the tokens are visible in the mail.
- ๐บ๐ธUnited States morbus iff
Likely related to https://www.drupal.org/project/commerce/issues/3401590 ๐ Dispatch the ORDER_PAID event for free orders when OrderStorage is destroyed Active .
I am facing the same problem, except it's for the "Order placed" event.
Some tokens are available ([commerce_order:total_price], [commerce_order:order_number], [commerce_order:placed], [commerce_order:mail], [commerce_order:order_items]) and others not :- [commerce_order:billing_profile]
- [commerce_order:payment_gateway]
- [commerce_order:shipments]
As jrochate, if I use the test function it gives me the expected result, meanwhile the real event firing not.
Everything is good in the default drupal order receipt sent to customer, but I cannot do what is excepted with this module and send a mail to the shop with all details.- ๐บ๐ฆUkraine marchuk.vitaliy Rivne, UA
vmarchuk โ made their first commit to this issueโs fork.
- ๐บ๐ฆUkraine marchuk.vitaliy Rivne, UA
Instead of [commerce_order:billing_profile] you should use something like [commerce_order:billing_profile:entity:address] or something else that is in [commerce_order:billing_profile:entity:*]. The same for the [commerce_order:payment_gateway] and [commerce_order:shipments] tokens.
I've tested the token replacement for the events Order Paid and Order Placed with Guest checkout enabled and everything works fine.
All the tokens below work fine:
[commerce_order:total_price]
[commerce_order:order_number]
[commerce_order:placed]
[commerce_order:mail]
[commerce_order:order_items]
[commerce_order:billing_profile:entity:address]
[commerce_order:payment_gateway:target_id]
[commerce_order:shipments] - show admin link to shipment (not sure how this can be useful for anonymous users)I'd be happy to help if anyone is still having trouble replacing tokens.
- ๐บ๐ฆUkraine chizh273
I have reproduced this issue partly, the
[commerce_order:order_number]
and[commerce_order:placed]
tokens are empty when the product price is 0.Steps to reproduce:
- create an email for the โOrder paidโ event and use [commerce_order:order_number] and [commerce_order:placed] tokens in the body field
-
create a product with 0 price (we need 0 price for
\Drupal\commerce_order\Entity\Order::isPaid
) - add to the cart this product and complete the checkout
-
you will receive email without
[commerce_order:order_number]
and[commerce_order:placed]
The problem here is related to the
\Drupal\commerce_order\OrderStorage
because\Drupal\commerce_order\Event\OrderEvents::ORDER_PAID
event is called in thedoOrderPreSave
method and at that time we donโt have filled theorder_number
andplaced
fields yet.These fields will be filled with
\Drupal\commerce_order\EventSubscriber\TimestampEventSubscriber::onPlaceTransition
and\Drupal\commerce_order\EventSubscriber\OrderNumberSubscriber::setOrderNumber
on thecommerce_order.place.pre_transition
event and this event is dispatched before order saving.When I enabled the
commerce_payment
module and configured manual payment, the issue was gone.To fix this issue, we can add the
doPostSave
method to theOrderStorage
and move theOrderEvents::ORDER_PAID
event dispatching to this method. If theOrderEvents::ORDER_PAID
is dispatched from thedoPostSave
method, we can be sure thatcommerce_order.place.pre_transition
was finished andorder_number
andplaced
fields are filled. But Iโm not sure if itโs a good idea to moveOrderEvents::ORDER_PAID
event dispatching to thedoPostSave
method. - Status changed to Closed: cannot reproduce
about 1 month ago 2:24pm 5 September 2025 - ๐บ๐ฆUkraine marchuk.vitaliy Rivne, UA
Closing this after 2 years of inactivity.
Now that this issue is closed, please review the contribution record.
As a contributor, attribute any organization helped you, or if you volunteered your own time.
Maintainers, please credit people who helped resolve this issue.