Custom fields

Custom fields are supported for every offer, via the Custom Fields panel on the offer detail page. To use custom fields, you must first create them in Shopware as follows:

  1. Access Settings > System > Custom fields.

  2. Select Individual Offer.

  3. Click Add New Set and complete the fields described in the table below.

  4. Click Save.

Setting

Type

Description

Technical name

Free text field

Unique identifier for the custom field. It must be unique and cannot be modified once the custom field has been saved.

Position

Free text field

Enter the position for the custom field (numerical value).

Manage labels in all administration languages

Toggle

Activate this setting to allow multiple language variants for the custom field.

Label

Free text field

Enter the label text for the custom field. If multiple language variants setting is activated, enter the label text in each supported language.

Assign to

Dropdown menu

Select a category to associate the custom field with.

You can also edit existing custom fields from this page by clicking the “…” menu button and selecting Edit.

Displaying custom fields in the storefront

To show custom fields in the storefront, you must implement template changes in your theme or via an extension.

For example: if you have created a text field with name prems_individual_offer_offer_test you could create a new file resources/views/storefront/page/individual_offer/index.html.twig in your theme.

Insert the following code to display the custom field:

{% sw_extends "@Storefront/storefront/page/individual_offer/index.html.twig" %}

{% block page_account_offers_table_order_number %}
{{ parent() }}
{% if order.customFields.prems_individual_offer_offer_test is defined %}
Your label test text: {{ order.customFields.prems_individual_offer_offer_test }}
{% endif %}
{% endblock %}

Last updated

Was this helpful?