When using Shopware 6, some users may encounter an issue where the Order Complete Email Template does not show line items in the preview. This can be frustrating as it prevents customers from getting a detailed summary of their order in the confirmation email.
Problem Identification
Upon investigation, it has been observed that the issue arises due to a discrepancy in the template code. Specifically, the template uses `nestedLineItems` instead of the correct variable `order.lineItems` to display the line items.
Solution
To resolve this issue and ensure that line items are displayed correctly in the Order Complete Email Template, follow these steps:
1. Accessing the Template
Log in to your Shopware 6 admin panel and navigate to `Settings` > `Email Templates`.
2. Locate the Order Complete Email Template
In the Email Templates section, find and open the template used for the Order Complete email. This template is typically named something like “Order Completed” or “Order Confirmation.”
3. Identify the Problematic Code
Within the template editor, search for the section that is responsible for displaying line items. Look for a code block similar to the following:
{% for lineItem in order.nestedLineItems %}
{{ lineItem.label }}
{{ lineItem.quantity }}
{{ lineItem.totalPrice }}
{% endfor %}
“`
4. Replace the Code
Replace the existing code block with the corrected code that references `order.lineItems` instead of `nestedLineItems`. Adjust the code like this:
“`
{% for lineItem in order.lineItems %}
{{ lineItem.label }}
{{ lineItem.quantity }}
{{ lineItem.totalPrice }}
{% endfor %}
“`
5. Save and Test
After making the changes, save the template. It’s recommended to send a test order to yourself or use the preview functionality to ensure that the line items are now displaying correctly in the Order Complete Email Template.
Conclusion
By following these steps and updating the Order Complete Email Template code to reference `order.lineItems`, you can successfully resolve the issue of line items not showing in the preview. This ensures that your customers receive comprehensive order details in their confirmation emails, improving their overall shopping experience.
If you encounter any further issues or need additional assistance, don’t hesitate to reach out to the Shopware development agency.