Create Field from admin in Shopware 6

The additional fields allow you to add your own fields for the various program areas in order to save your own information here. For example, you can enter your own additional information for products or categories that are not yet available in the standard system, which you can then use in the rulebuilder or display in the storefront.

What are Custom Fields?

Custom Fields are those which are used to add your own fields on different program-areas to add some additional information. For example you can add the custom fields to show any additional information for products or categories which is not yet available in standard system.

You can create custom fields using the navigation: Settings -> System -> Custom fieldsshopware custom field 1

To add a new Custom Field Click on Add new setshopware custom field 2

After that you can create the set and then you need to assign the set to any of the program-areasshopware 3

Shopware 4

Click Save and then create New Custom Field.shopware 5

Then you need to add value to the fields, go to list of products

select product -> edit -> Specifications -> customFields section -> Insert Data -> Click SaveShopware 6

Add custom field in the Frontend in Shopware 6

Adding custom fields in the storefront is quite simple. You basically use Twig this way:

{{ "customFields.custom_description_Name"|trans|sw_sanitize }}: {{ page.product.translated.customFields.custom_description_Name }}

You can use the custom field on product detail page like that:

<plugin root>/src/Resources/views/storefront/page/product-detail/description.html.twig
{% sw_extends '@Storefront/storefront/page/product-detail/description.html.twig' %}

{% block page_product_detail_description_content_text %}
    {{ parent() }}
    {# Insert your custom field here, as seen below: #}
    {{ "customFields.custom_description_Name"|trans|sw_sanitize }}: {{ page.product.translated.customFields.custom_description_Name }}
{% endblock %}
Avatar photo
Author

Founder and tech lead at Emizentech, Mr. Vivek has over ten years of experience in developing IT infrastructures and solutions. With his profound knowledge in eCommerce technologies like Shopware, Magento, and Shopify, Mr. Vivek has been assisting SMEs to enterprises across the globe by developing and maintaining their eCommerce applications. Technology innovation and trends insight come easy to Vivek with his thorough knowledge in the eCommerce domain. See him talking about ideas, trends, and technology in this blog. To know more about how Team Vivek can assist you in your eCommerce strategy? Connect team Vivek here.

whatsapp