How-To Guide¶
This document provides step-by-step workflows for common tasks with the Tax calculator and shipping country switch plugin.
How the Plugin Works¶
Data Flow Overview¶
[Visitor selects country in dropdown]
↓
[POST /switch_context with country=ISO]
↓
[CustomConfigureController sets sw-country cookie & invalidates product cache]
↓
[BaseContextFactoryDecorator overrides CountryId in SalesChannelContext]
↓
┌──────────────────────────┬──────────────────────────┬──────────────────────────┐
↓ ↓ ↓ ↓
[CustomProductPrice [CustomCartProcessor [CustomDelivery [Checkout / registration
Calculator updates cart Calculator adjusts pre-fills selected
computes gross from line items with shipping costs to delivery country]
net & country tax] new prices] country tax]
In short: The switcher sets the delivery country in the context object. All subsequent price, cart, and shipping calculations then run with the new tax rate — always starting from net.
Common Workflows¶
How to: Set up the plugin for the first time¶
Goal: Configure the plugin to be operational after installation
Time Required: approx. 15 minutes
Prerequisites: - Plugin installed and activated - At least one sales channel with active delivery countries - Correct tax rates per country in Shopware
Steps:
- Open plugin configuration
- Navigate to:
Extensions → My Extensions → Tax calculator and shipping country switch → Configure -
Select the desired sales channel in the top right
-
Set base configuration
Activate the selection dropdown→ onShow flags in dropdown→ as desired-
Topbar display mode→Replace topbarfor simple themes,Extend theme's topbarif your theme already has a topbar -
Exclude home country
- Open the
Calculation Settingscard - In the
Skip countriesfield, add your home country (e.g. Germany) -
Reason: Gross prices are already maintained correctly there
-
Enable shipping costs (optional)
Shipping cost configurationcard-
Enable
Adjust shipping costs based on net costs -
Save and clear caches
- Save button in the top right
Settings → System → Caches & Indexes → Clear cache
Result: The country switcher appears in the storefront and automatically recalculates prices for non-home countries.
Troubleshooting: See the "Troubleshooting" section in the Usage Guide.
How to: Add a new delivery country to the switcher¶
Goal: Enable a previously unavailable country in the switcher dropdown
Time Required: approx. 5 minutes
Steps:
- Activate the country in the sales channel
- Navigate to:
Sales Channels → [Your sales channel] → General → Countries -
Activate the desired country and save
-
Verify tax rate for the country
- Navigate to:
Settings → Shop → Taxes - For each product that should be shipped to this country, check whether a matching country rule exists
-
If not: create a new tax rule with the correct rate
-
Enable shipping method for the country
- Navigate to:
Settings → Shop → Shipping -
For the relevant shipping methods, add the new country in the availability rule
-
Clear caches
Result: The new country appears in the dropdown and prices are recalculated correctly.
How to: Customize styling to match your theme¶
Goal: Adjust dropdown colors and spacing to match the shop's corporate design
Time Required: approx. 10 minutes
Steps:
- Open plugin configuration
- Open the
Styling configurationcard - Set colors
Text color of select— adjust to theme foreground colorColor of select background— adjust to theme background colorColor of select border— e.g. accent color of your theme- Padding and border
Padding of select: e.g.8px 12pxRadius of select border: e.g.4pxWidth of select border: e.g.1pxWidth of select: e.g.180pxorauto- Save and clear the storefront cache
Result: The country switcher uses the new CSS variables in the frontend.
How to: Upgrade from 4.x or 3.x to 5.0.0¶
Goal: Migrate an existing installation to the multi-version codebase
Time Required: approx. 10 minutes
Prerequisites:
- Shopware 6.6 or 6.7
- Backup of the database and custom/plugins/WebLa_TaxCalculatorAndCountrySwitcher/
Steps:
- Create backup — database and plugin folder
- Check Shopware version — 6.6.0 or higher required
- Deactivate the old plugin:
Extensions → My Extensions → Deactivate - Upload the new ZIP via the Plugin Manager or replace directly in
custom/plugins/ - Update and activate the plugin:
- Check configuration — all settings are preserved
- Test storefront — spot-check the country switcher in all sales channels
Result: The installation runs on version 5.0.0 with the multi-version codebase. All settings and sales channel configurations are preserved.
Quick Reference¶
| Task | Key Steps | Settings Required |
|---|---|---|
| Activate the plugin | Extensions → Activate → Configure | Activate the selection dropdown |
| Display flags | Configure → Display configuration | Show flags in dropdown |
| Skip home country | Configure → Calculation Settings | Skip countries |
| Recalculate shipping costs | Configure → Shipping cost configuration | Adjust shipping costs based on net costs |
| Preserve theme topbar | Configure → Display configuration | Topbar display mode = Extend theme's topbar |
| Dropdown styling | Configure → Styling configuration | All styling fields |
Best Practices¶
- Always exclude the home country: Gross prices are already maintained correctly in your main market — double calculation avoids unnecessary load and rounding differences
- Consistently maintain tax rates per country: The plugin can only calculate as well as the country tax rules allow
- Create a test product: A fixed test product with a known net price helps verify calculation correctness for each target country
- Watch cache behavior: The plugin adds the
countryparameter to the HTTP cache key — CDNs and reverse proxies must honor this parameter - Configure per sales channel: Different shops (e.g. B2C and B2B) often have different requirements — use sales-channel-specific configuration
What to Avoid¶
- ❌ Excluding all countries at once — the plugin then has no effect, you might as well disable it
- ❌ Letting prices be recalculated in the home country — always add the home country to the skip list
- ❌ Ignoring missing tax rules — without a country tax rule, a fallback is used that can lead to wrong gross prices
- ❌ Not clearing the storefront cache after configuration changes — old values would otherwise persist in the HTTP cache