Custom fields are a basic feature of Shopware 6 and allow you to extend products, categories or manufacturers individually. With custom fields you can flexibly store additional information and output it in the storefront when needed.
Because neither Shopware nor ThemeWare® can know in which file or in which Twig block your individual custom field should be integrated, individual custom fields have to be embedded into the storefront manually.
This works either with a CMS element in a Shopping Experience layout or with an individual template customisation.
CMS element
- Advantages
- very easy to implement
- Disadvantages
- only available from Shopware 6.6.9
- it is not possible to check whether a custom field is empty
Template customisation
- Advantages
- already available before Shopware 6.6.9
- it is possible to check whether a custom field is empty
- Disadvantages
- quite complex to implement
In this tutorial we explain how you can output custom fields in the storefront with a CMS element.
Note: How to output a custom field in the storefront with a template customisation you will discover in the tutorial Show custom fields in the storefront.
Note: Individual custom fields are integrated into the CMS system from Shopware 6.6.9. Before Shopware 6.6.9 you can only output individual custom fields in the storefront with a template customisation: Show custom fields in the storefront
Output a custom field with a CMS element
Thanks to the integration of individual custom fields into the CMS system of Shopware 6, custom fields can be embedded seamlessly into text fields.
In the following step-by-step guide we embed the individual custom field "Safety notice" with a CMS block on the product detail page in the storefront.
Tip: How to create an individual custom field you will discover in the tutorial Custom Fields
Assign a custom field to a CMS block
1) Edit the Shopping Experience
Switch to the Shopping Experiences management:
"Content" => "Shopping Experiences"
Open the CMS layout of your product detail pages there to edit the layout.
2) Insert a CMS block
Now insert a CMS block from the category "Text" into your layout.
3) Open the settings of the CMS element
Click on the
cog icon at the top right of the corresponding text element to open the element settings.

CMS slot ⇒ action buttons
Note: The cog icon appears once you have clicked on the CMS block and the mouse is inside the block.
4) Insert the custom field
In Shopware 6.6.9.0 you have two options for inserting it:
- Data mapping (see 4.1)
- Variable (see 4.2)
4.1) Assign the custom field
This is the simpler variant, but it is not possible to insert further custom fields or texts into the CMS element here.
Click on the link "Data mapping" (1) and select your custom field (2).
e.g. product.customFields.custom_gpsr_sicherheitshinweis

Custom field ⇒ data mapping
Note: If a custom field is not available in the list, try the following manual method.
4.2) Insert the custom field as a variable
In this variant you can also insert several custom fields and text into the CMS element.
Click on the button for inserting a variable (1) and select your custom field (2).
e.g. product.customFields.custom_gpsr_sicherheitshinweis

Custom field ⇒ variable
Alternatively, you can also insert the custom field as a variable directly in the HTML editor:
<h3>Safety notice:</h3>
<div>
{{ product.customFields.custom_gpsr_sicherheitshinweis }}
</div>
The CMS element now looks like this in the editor:

CMS element with custom field
Note: You can output a custom field of a manufacturer with the following syntax:{{ product.manufacturer.customFields.YOURCUSTOMFIELD }}
5) Save your change
The custom field is now output in the storefront, provided it has been filled in the corresponding product.
6) Clear the cache
Finally, clear the Shopware cache and your browser cache once so that the change is displayed correctly in the storefront.
Example

Custom field in a Shopping Experience
Tip: If necessary, add the CSS class twt-cms-block-reset to the corresponding CMS block to disable the ThemeWare® CMS styling for this block.
Further information
You can find more information about custom fields in the following article:
Custom Fields