How to detect order type (recurring or not) in order confirmation and shipping confirmation email templates?
Question
When order is placed an emails is sent to the user generated with template commerce-order-receipt--default.html.twig
When order is shipped another email is sent to the user, now generated with template file commerce-shipment-notification.html.twig
How to detect from those 2 files if it's a first order (generated by user action) or it was recurring order (generated automatically, by cron)?
I need a way to display different content inside those emails based on this criteria.
Solution
Found the way - I can check variable order_entity.bundle
for order type and it's value can be "default" or "recurring".
However order receipt email is sent only once, when order is placed and not when recurring order is created, so it's not used for recurring order types at all. I guess that's normal.