I am trying to create a model where an email is sent via the website, once an order has been completed, depending on which payment gateway has been used. I have two payment gateways, with the ID's of 'credit' and 'bank_transfer'. If a person pays by credit card, no email is required to be sent. If someone uses the bank transfer option, then an email is sent, with further instructions.
What I can do:
- Create start event, with Checkout: Completion
- Send email, with tokens from the order to the buyer, for a customised message
Without a condition, the above works flawlessly, with tokens replaced correctly.
What I can't do:
Add a condition, where the email is ONLY fired, if the customer has used the Bank transfer (bank_transfer) gateway.
I have tried every combination I can think of, but just can't get it working. Adding this condition in any form just blocks the email being sent at all. I have added the template Commerce: Selected payment gateway, added the ID of bank_transfer into the Payment gateways field, and a wide range of different options into the Entity field, without brackets. I've referenced the Token help list and tried...
commerce_order:payment_gateway
commerce_order:payment_gateway:entity
commerce_order:payment_gateway:target_id
payment_gateway
payment_gateway:entity
payment_gateway:target_id
... each either blocking the email without error, or an error is thrown in logs (the only error I've had is, The condition requires a "commerce_order" entity, but a "commerce_payment_gateway" entity was given). Commerce 3 and Drupal 10 is being used.
Any help would be greatly appreciated.