Workaround: Load orderEmployee Extension for Email Templates
Problem: The orderEmployee extension from Shopware Commercial B2B is not automatically loaded when rendering order confirmation emails, even though it's available for storefront order views via OrderRouteRequestSubscriber.
Solution: Create a MailService decorator that intercepts email sending and loads the missing extension before template rendering.
and the use this in the 'Email Template':
{% if order.extensions.orderEmployee is defined and order.extensions.orderEmployee|length > 0 %}
{% set orderer = order.extensions.orderEmployee|first %}
{{ orderer.firstName }} {{ orderer.lastName }}
{% else %}
{{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }}
{% endif %}
Hint: use addExtension() instead of replacing the entire order entity to avoid serialization issues
Workaround: Load orderEmployee Extension for Email Templates
Problem: The orderEmployee extension from Shopware Commercial B2B is not automatically loaded when rendering order confirmation emails, even though it's available for storefront order views via OrderRouteRequestSubscriber.
Solution: Create a MailService decorator that intercepts email sending and loads the missing extension before template rendering.
and the use this in the 'Email Template':
{% if order.extensions.orderEmployee is defined and order.extensions.orderEmployee|length > 0 %}
{% set orderer = order.extensions.orderEmployee|first %}
{{ orderer.firstName }} {{ orderer.lastName }}
{% else %}
{{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }}
{% endif %}
Hint: use addExtension() instead of replacing the entire order entity to avoid serialization issues