Markus Michalski FAQ

Product Snippets: Configuration

Create and manage product snippets in the Shopware Admin - fields, identifier rules, multi-language content, placeholder syntax and practical examples for product descriptions

Deutsche Version

Back to overview

Product Snippets: Configuration

Live Demo: Try this and other plugins live — no installation, no risk: demo.markus-michalski.net

The plugin has no settings under Extensions > My Extensions. Everything is managed in the admin module Content > Product Snippets.

The list

The list shows the columns Identifier, Name and Active and is sorted by identifier by default. You can search, edit and delete snippets. Create Snippet adds a new one.

Creating a snippet

  1. Click Create Snippet
  2. Enter an Identifier (for example warranty-info)
  3. Optionally enter a Display Name
  4. Write the Content in the text editor
  5. Leave Active switched on
  6. Click Save

After saving you return to the list.

Fields

Field Required Description
Identifier yes Technical name used in the placeholder. The Save button stays disabled while the field is empty. After creation the admin interface locks the field, so you cannot change the identifier there any more.
Display Name no Only for orientation in the list and in the admin search. It does not appear in the shop.
Active no Only active snippets are replaced. The switch is preset when you create a snippet.
Content no The text that the placeholder is replaced with. Edited as HTML in the text editor.

Display Name and Content depend on the language, Identifier and Active apply to all languages.

Identifier rules

The admin field does not validate the identifier. When replacing, however, the plugin only recognizes placeholders whose identifier consists of letters (a-z, A-Z), digits, hyphens and underscores. An identifier with a dot, a space or an umlaut can be saved but is never found by a placeholder.

Multi-language content

You maintain display name and content per language:

  1. Create the snippet and save it. The language switch is disabled while creating.
  2. Open the snippet again and choose the desired language in the language switch.
  3. Enter the translated content and save.

The storefront outputs the content in the language of the current context. Therefore, provide the content for every language in which the snippet should appear.

Using placeholders

Insert a placeholder into a product description:

Syntax Description
{{snippet:identifier}} Standard syntax
{{textbaustein:identifier}} German alias
{{ snippet:identifier }} Whitespace inside the braces is allowed

The prefix snippet or textbaustein is recognized regardless of case. Where the replacement takes place is described on the Storefront Integration page.

Practical examples

Warranty notice

  1. Identifier: warranty-info
  2. Display Name: Warranty Information
  3. Content:
<p><strong>2-Year Warranty</strong></p>
<p>This product includes a 2-year manufacturer warranty covering defects in materials and workmanship.</p>

Product description:

<h2>Premium Widget</h2>
<p>High-quality widget for professional use.</p>

{{snippet:warranty-info}}

{{snippet:shipping-info}}

In the product description of the product layout both placeholders are replaced by the stored content. If shipping-info does not exist or is inactive, {{snippet:shipping-info}} stays in the text unchanged.

Typical uses

Digital products:      {{snippet:format-disclaimer}}  {{snippet:download-info}}  {{snippet:license-terms}}
Physical products:     {{snippet:shipping-info}}  {{snippet:return-policy}}  {{snippet:warranty-info}}
Seasonal promotions:   {{snippet:holiday-shipping}}  {{snippet:sale-notice}}

Notes on HTML in the content

When the content is output, it is cleaned by Shopware's HTML sanitizer. Unsafe parts such as scripts are removed, regular formatting such as paragraphs, bold text, lists or links is kept. On product cards in listings every HTML tag is removed, see Storefront Integration.