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.
| Snippet | Used 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.toggle | names for screen readers |
taxswitch.label.taxFree | shown 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.description | entry 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;
}
| Variable | Effect |
|---|---|
--taxswitch-color | text color |
--taxswitch-active-bg | background of the active choice (default: color of the buy button) |
--taxswitch-active-color | text color of the active choice |
--taxswitch-hover-bg | hover background |
--taxswitch-border-color | border color |
--taxswitch-radius | corner radius |
--taxswitch-focus-color | focus outline for keyboard use |
--taxswitch-padding-x, --taxswitch-padding-y | inner 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.twig | component_taxswitch_switcher_dropdown, …_segmented, …_toggle, …_link |
taxswitch-popup.html.twig | component_taxswitch_popup_headline, …_text, …_card_gross_content, …_card_net_content |
taxswitch-cookie-hint.html.twig | component_taxswitch_cookie_hint_text, …_button_allow, …_button_settings |
taxswitch-secondary-price.html.twig | component_taxswitch_secondary_price_content, …_amount, …_list_price |
Keep the data-taxswitch-* attributes, otherwise the buttons do not react.