In this article, you will learn how to create new snippets in Shopware 6. Shopware uses snippets for the translation and customization of texts, which can be managed at this point.
The goal of Shopware is to make the customer experience, the brand, and the product on the different sales channels for different markets, customer groups’ experience and availability.
Shopware has more flexibility, less complexity, and offers the latest technology stack. Shopware is now starting to enter new European nations and is making a big impact in the UK. You can check here other Shopware modules – https://store.webkul.com/Shopware.html
What are the benefits of Snippets?
Snippets are very useful to translate and customize the Shopware storefront texts. By using snippets, you are able to determine the content of a specific text part of the theme individual for every shop.
The major benefit of snippet use is internationalization. If your extension uses snippets, it will be easy to identify and fix missing translations, making your plugin compatible with Shopware shops aimed at different markets.
Shopware Company ? Find out More
Creating New Snippets
If you need an additional snippet, you can create a new snippet within a snippet set. New snippets are created globally. Therefore, you do not need to create every snippet individually. You can then maintain the contents of the snippet for all snippet sets.
To create a new snippet, first switch to a snippet set. This is possible by either clicking directly on the name of the set or by opening the context menu by clicking the “…” button.
First, assign a Name for the new snippet. Since the name is also used for the integration, for example, in the front end, we recommend that you do not use spaces or special characters. You should also choose a meaningful name.
In Translations, a separate field is displayed for each existing text module set. The new snippet can only be saved if you have given it a valid name.
Creating a new snippet Set
To Create a new Snippet follow the below steps. You have to go to the Settings > Shop > Snippets.
If you want to use a snippet in a sales channel that differs from the standard, you can solve this by using your own snippet set. If you want to use different snippet sets in a sales channel with different URLs for England and Ireland.
You have two options for creating a new snippet set. Based on one of the base files (German and English are present in the standard version) you can create a new set by clicking the button Add Snippet Set.
You can duplicate an already existing set, this is also possible for sets you have created yourself. Next to the Add button or the context menu of a Snippet Set by clicking the “…” button.
When duplicating you can choose from all existing sets. The duplicate is created directly with the same name and the additional copy. You can change the name later on in the overview.
To do this, double-click on the line of the snippet set whose name you want to change.
Please note that – If you click on the name of the set, you will take to the overview of the contained snippets and the name cannot change there.
I hope you have now gained some new information through the snippets in Shopware 6 article. For any query in Shopware, you can send us an email at [email protected].
Please let us know if you want to discuss your Shopware project, you can ping us anytime at our skype: https://bit.ly/Akeneo-Shopware-Pimcore.