For the complete documentation index, see llms.txt. This page is also available as Markdown.

Template samples

This page contains the bundled default templates for reference and copying. They match exactly what the Load default template and Load default CSS buttons insert in the administration.

How to copy: Hover over a code block and click the copy icon in the top right. Then paste the content into the matching field of the document configuration.

Available templates:


Line items table (Twig)

This template belongs in the field "Table for order items (Twig template)" (card "Order items"). It is rendered in three phases (table, position, shipping) – for details see Line items table.

German

{% if hueRenderPhase == 'table' and config.displayLineItems %}
    <table class="line-item-table">
        <thead>
        <tr class="line-item-table-header">
            {% if config.displayLineItemPosition %}
                <th>Pos.</th>
            {% endif %}
            <th class="product-number">Prod.-Nr.</th>
            <th class="product-label">Produkt / Dienst</th>
            <th class="numbers">Anzahl</th>
            {% if config.displayPrices %}
                {% set companyTaxEnabled = billingAddress.country.companyTax.enabled %}
                {% set displayAdditionalNoteDelivery = config.displayAdditionalNoteDelivery %}
                {% set isDeliveryCountry = billingAddress.country.id in config.deliveryCountries %}
                {% set taxStatusGross = order.price.taxStatus == 'gross' %}
                {% set taxStatusNet = order.price.taxStatus == 'net' %}

                {% set displayVAT = not companyTaxEnabled or not (displayAdditionalNoteDelivery and isDeliveryCountry) %}
                <th class="numbers">USt.</th>

                <th class="numbers incl-vat">
                    Stückpreis
                    {% if displayVAT %}
                        {% if taxStatusGross %}
                            <span>Inkl. MwSt.</span>
                        {% elseif taxStatusNet %}
                            <span>Exkl. MwSt.</span>
                        {% endif %}
                    {% endif %}
                </th>

                <th class="numbers incl-vat">
                    Gesamt
                    {% if displayVAT %}
                        {% if taxStatusGross %}
                            <span>Inkl. MwSt.</span>
                        {% elseif taxStatusNet %}
                            <span>Exkl. MwSt.</span>
                        {% endif %}
                    {% endif %}
                </th>
            {% endif %}
        </tr>
        </thead>
{% elseif hueRenderPhase == 'position' and config.displayLineItems %}
    {% set class = '' %}
    {% if level > 0 %}
        {% set class = " nested level-" ~ level %}
    {% endif %}

    <tr class="line-item{{ class }}{% if first %} first{% endif %}" tabindex="0">
        {% block document_line_item_table_rows %}
            {% block document_line_item_table_row_position %}
                {% if config.displayLineItemPosition %}
                    <td>{% block document_line_item_table_column_position %}{{ prefix ~ position }}{% endblock %}</td>
                {% endif %}
            {% endblock %}

            {% block document_line_item_table_row_product_number %}
                {% if lineItem.payload.productNumber %}
                    <td class="line-item-product-number">{% block document_line_item_table_column_product_number %}{{ lineItem.payload.productNumber }}{% endblock %}</td>
                {% else %}
                    <td>{% block document_line_item_table_column_product_number_empty %}{% endblock %}</td>
                {% endif %}
            {% endblock %}

            {% block document_line_item_table_row_label %}
                <td class="line-item-breakable">
                    {% block document_line_item_table_column_label %}
                        {% if level > 0 %}
                            {% for i in 1..level %}
                                <span class="wrapper-wrapper">
                                    <span class="label-wrapper level-{{ i }}"></span>
                                </span>
                            {% endfor %}
                        {% endif %}

                        <span class="line-item-label level-{{ level }}">{{ lineItem.label|sw_sanitize(null, true) }}</span>
                        {% if lineItem.payload.options|length >= 1 %}
                            <br/>
                            {% for option in lineItem.payload.options %}
                                {{ option.group|sw_sanitize(null, true) }}: {{ option.option|sw_sanitize(null, true) }}
                                {% if lineItem.payload.options|last != option %}
                                    {{ " | " }}
                                {% endif %}
                            {% endfor %}
                        {% endif %}

                        {% if lineItem.payload.features|length >=1  %}
                            <br/>
                            {% for feature in lineItem.payload.features %}
                                {% if feature.type == 'referencePrice' %}
                                    {{ feature.value.purchaseUnit|sw_sanitize(null, true) }} {{ feature.value.unitName|sw_sanitize(null, true) }}
                                    ({{ feature.value.price|currency(currencyIsoCode, languageId) }}{{ "general.star"|trans }} / {{ feature.value.referenceUnit|sw_sanitize(null, true) }} {{ feature.value.unitName|sw_sanitize(null, true) }})
                                    {% if lineItem.payload.features|last != feature %}
                                        {{ " | " }}
                                    {% endif %}
                                {% endif %}
                            {% endfor %}
                        {% endif %}
                    {% endblock %}
                </td>
            {% endblock %}

            {% block document_line_item_table_row_quantity %}
                <td class="align-right">{% block document_line_item_table_column_quantity %}{{ lineItem.quantity }}{% endblock %}</td>
            {% endblock %}

            {% block document_line_item_table_prices %}
                {% if config.displayPrices %}
                    {% block document_line_item_table_row_tax_rate %}
                        <td class="align-right">{% block document_line_item_table_column_tax_rate %}{% for tax in lineItem.price.taxRules %}{{ tax.taxRate }} % {% if loop.last %}{% else %}<br>{% endif %}{% endfor %}{% endblock %}</td>
                    {% endblock %}
                    {% block document_line_item_row_table_unit_price %}
                        <td class="align-right">
                            {% block document_line_item_column_table_unit_price %}
                                {% set unitPrice = lineItem.unitPrice %}
                                {% if config.fileType == constant('Shopware\\Core\\Checkout\\Document\\Service\\HtmlRenderer::FILE_EXTENSION') %}
                                    {% if unitPrice < 0 %}&minus;{% endif %}{{ unitPrice|abs|currency(currencyIsoCode, languageId) }}
                                {% else %}
                                    {{ unitPrice|currency(currencyIsoCode, languageId) }}
                                {% endif %}
                            {% endblock %}
                        </td>
                    {% endblock %}
                    {% block document_line_item_table_row_total_price %}
                        <td class="align-right">
                            {% block document_line_item_table_column_total_price %}
                                {% set totalPrice = lineItem.totalPrice %}
                                {% if config.fileType == constant('Shopware\\Core\\Checkout\\Document\\Service\\HtmlRenderer::FILE_EXTENSION') %}
                                    {% if totalPrice < 0 %}&minus;{% endif %}{{ totalPrice|abs|currency(currencyIsoCode, languageId) }}
                                {% else %}
                                    {{ totalPrice|currency(currencyIsoCode, languageId) }}
                                {% endif %}
                            {% endblock %}
                        </td>
                    {% endblock %}
                {% endif %}
            {% endblock %}
        {% endblock %}
    </tr>
{% elseif hueRenderPhase == 'shipping' and config.displayLineItems %}
    <tr class="line-item" tabindex="0">
        {% if config.displayLineItemPosition %}
            <td>{{ nestedLineItems.count + 1 }}</td>
        {% endif %}
        {% block document_line_item_table_shipping_number %}
            <td></td>
        {% endblock %}
        {% block document_line_item_table_shipping_label %}
            <td class="line-item-breakable">{{ 'document.lineItems.shippingCosts'|trans|sw_sanitize }} - {{ order.deliveries.first.shippingMethod.translated.name }}</td>
        {% endblock %}
        <td class="align-right">1</td>
        {% if config.displayPrices %}
            {% block document_line_item_table_shipping_tax %}
                <td class="align-right">{% for tax in order.deliveries.first.shippingCosts.calculatedTaxes %}{{ tax.taxRate }} % {% if loop.last %}{% else %}<br>{% endif %}{% endfor %}</td>
            {% endblock %}

            {% block document_line_item_table_unit_price %}
                <td class="align-right">{{ order.shippingTotal|currency(currencyIsoCode, languageId) }}</td>
            {% endblock %}

            {% block document_line_item_table_total_price %}
                <td class="align-right">{{ order.shippingTotal|currency(currencyIsoCode, languageId) }}</td>
            {% endblock %}
        {% endif %}
    </tr>
{% endif %}

English


Twig template for the summary

This template belongs in the field "Twig template for the summary" (card "Order items"). For details see Calculation summary.

German

English

Note: For the delivery note the summary is intentionally left empty, since delivery notes usually do not show price totals.


Default CSS of the line items table

This CSS belongs in the field "Styles for the table of order items" (card "Order items") and matches the Shopware standard layout.

Zuletzt aktualisiert