Home Devert | Switch between gross/net in frontend (DevertTaxSwitch) Documentation Shopware Store ↗ Deutsch

Texts, colors, templates

Change texts in the Administration, colors with a few lines of CSS, and the markup with Twig blocks.

Change texts

All texts are snippets under Settings → Snippets. Search for taxswitch. German, English, Dutch and French are included.

SnippetUsed for
taxswitch.label.grossNet.*
taxswitch.label.inclExcl.*
taxswitch.label.privateBusiness.*
taxswitch.label.privateBusinessLong.*
the four label styles, each with gross and net
taxswitch.label.link.*texts of the “text link” appearance
taxswitch.label.title, taxswitch.label.togglenames for screen readers
taxswitch.label.taxFreeshown for tax-free deliveries
taxswitch.popup.*headline, text and cards of the popup
taxswitch.cookie.hint*, taxswitch.cookie.allowAndSwitch*cookie hint
taxswitch.cookie.name, taxswitch.cookie.descriptionentry in the cookie settings
taxswitch.secondaryPrice.*second price, %price% is the amount

The popup texts are plain text. The buttons are part of the template.

Colors and spacing

The defaults come from your theme. Set your own values with CSS variables, for example in the SCSS of your theme. With html:root they win regardless of the load order:

html:root {
  --taxswitch-active-bg: #0a7d5a;
  --taxswitch-active-color: #ffffff;
  --taxswitch-radius: 999px;
}
VariableEffect
--taxswitch-colortext color
--taxswitch-active-bgbackground of the active choice (default: color of the buy button)
--taxswitch-active-colortext color of the active choice
--taxswitch-hover-bghover background
--taxswitch-border-colorborder color
--taxswitch-radiuscorner radius
--taxswitch-focus-colorfocus outline for keyboard use
--taxswitch-padding-x, --taxswitch-padding-yinner spacing

Each switch also has the classes taxswitch-switcher, taxswitch-style-<appearance> and taxswitch-switcher-<position>. Check the contrast when you use your own colors.

Override templates

Override blocks in your theme with sw_extends. Example: an extra paragraph below the popup text. Create the file src/Resources/views/storefront/component/taxswitch-popup.html.twig in your theme:

{% sw_extends '@Storefront/storefront/component/taxswitch-popup.html.twig' %}

{% block component_taxswitch_popup_text %}
    {{ parent() }}
    <p class="small">You can change this at any time.</p>
{% endblock %}
File (in storefront/component/)Main blocks
taxswitch-switcher.twigcomponent_taxswitch_switcher_dropdown, …_segmented, …_toggle, …_link
taxswitch-popup.html.twigcomponent_taxswitch_popup_headline, …_text, …_card_gross_content, …_card_net_content
taxswitch-cookie-hint.html.twigcomponent_taxswitch_cookie_hint_text, …_button_allow, …_button_settings
taxswitch-secondary-price.html.twigcomponent_taxswitch_secondary_price_content, …_amount, …_list_price

Keep the data-taxswitch-* attributes, otherwise the buttons do not react.