Tax Switch for WooCommerce

Description

Tax Switch for WooCommerce enhances your WooCommerce store by allowing users to toggle between displaying prices including or excluding VAT. This plugin adds a customizable switch component and provides a flexible way to display both price versions.

Key features

  • Display customizable switches where you want
  • Gutenberg block support
  • Shortcode for easy integration (including shortcode generator)
  • Flexible display options for prices with and without VAT
  • Remembers the user’s preference for future visits
  • Choose between a toggle switch or buttons

For more information about this plugin, please visit the plugin page.

Compatibility

This plugin integrates with WooCommerce’s standard filters and actions for price display and calculation. While most plugins and themes work out of the box, some third-party code use custom price building methods that require specific compatibility integrations.

The following themes have been tested and confirmed compatible:

  • GeneratePress
  • Blocksy
  • Thrive
  • Flatsome

The following plugins have been tested and confirmed compatible:

  • WooCommerce Product Table Lite (+ PRO)
  • Tiered Pricing Table for WooCommerce (+ Premium)
  • Measurement Price Calculator for WooCommerce
  • Discount Rules for WooCommerce
  • YITH WooCommerce Product Add-Ons (+ & Extra Options Premium)
  • JetEngine Listing Grid (Elementor)
  • Product Add-Ons for WooCommerce
  • B2BKing – Ultimate WooCommerce Wholesale and B2B Solution (+ Premium)
  • Advanced Product Fields Pro for WooCommerce
  • WooCommerce Quantity Discounts, Rules & Swatches
  • FacetWP

If you encounter any compatibility issues with other plugins or themes, please let us know. Your feedback helps us improve the plugin and extend compatibility to more third-party solutions.

Incompatibility

After multiple attempts to create compatibility functions, reaching out to the plugin developers several times, and still finding no viable solution, the following plugins remain incompatible:

  • Unlimited Elements for Elementor (+ Pro): AJAX pagination and filtering issues

WPML

To translate the option texts via WPML:

  1. Save your options first in: WooCommerce -> Settings -> Tax Switch
  2. Then translate the texts in: WPML -> String Translations and search for your option values in the domain ‘tax-switch-for-woocommerce’

Requirements

  • WooCommerce plugin installed and activated
  • WooCommerce tax calculations enabled and configured

Usage

After installation and configuration, you can add the tax switch to your pages in two ways:

  1. Use the Gutenberg block “Tax Switch for WooCommerce” in your page or post editor.
  2. Use the shortcode [wdevs_tax_switch] anywhere in your content.

Shortcode Usage

Switch/buttons

Basic usage:
[wdevs_tax_switch]

The shortcode accepts several attributes to customize its appearance and behavior:

  • class-name: Adds custom CSS classes to the switch.
    • Default: is-style-default
    • Options: is-style-default, is-style-inline, or custom classes
  • switch-type: Determines the style of the toggle.
    • Default: switch
    • Options: switch, buttons
  • switch-color: Sets the color of the switch handle.
  • switch-color-checked: Sets the color of the switch when it’s in the “on” position.
  • switch-background-color: Sets the background color of the switch.
  • switch-text-color: Sets the text color of the switch labels.
  • switch-background-color-checked: Sets the background color of the switch when it’s in the “on” position.
  • switch-label-incl: Sets the text for the “including VAT” label.
    • Default: Uses the text set in the plugin settings or “Incl. VAT” if not set.
  • switch-label-excl: Sets the text for the “excluding VAT” label.
    • Default: Uses the text set in the plugin settings or “Excl. VAT” if not set.

Example with custom attributes:

[wdevs_tax_switch class-name="is-style-inline" switch-type="switch" switch-color="#ffffff" switch-color-checked="#000000" switch-background-color="#000000" switch-background-color-checked="#4CAF50" switch-text-color="#FF0000" switch-label-incl="Incl. tax" switch-label-excl="Excl. tax"]

This will display an inline-style switch with a white handle that turns black when on, a black background when off, green background when on, and custom labels for including and excluding tax.

Label

Basic usage:
[wdevs_tax_switch_label]

Displays text indicating the currently selected tax setting. The text updates automatically when the tax switch is toggled.

Attributes:
* class-name: Adds custom CSS classes to the label.
– Default: is-style-default
– Options: is-style-default or custom classes
* label-text-incl: Sets the text to display when “including VAT” is selected.
– Default: Uses the text set in the plugin settings or “Incl. VAT” if not set.
* label-text-excl: Sets the text to display when “excluding VAT” is selected.
– Default: Uses the text set in the plugin settings or “Excl. VAT” if not set.
* label-text-color: Sets the “excluding VAT” text color.
* label-text-color-checked: Sets the “including VAT” text color.

Example with custom attributes:

[wdevs_tax_switch_label class-name="tax-indicator" label-text-incl="Prices include tax" label-text-excl="Prices exclude tax" label-text-color="#FF0000" label-text-color-checked="#4CAF50"]

PHP implementation

You can use these shortcodes with PHP with the do_shortcode() function:

<?php echo do_shortcode('[wdevs_tax_switch]'); ?>
<?php echo do_shortcode('[wdevs_tax_switch_label]'); ?>

JavaScript events

The switch fires a JavaScript event when the tax display is toggled. You can listen for this event to execute custom code when a user switches between inclusive and exclusive tax display. This is useful for when you need to perform additional actions based on the tax display state.

document.addEventListener('wdevs-tax-switch-changed', function(event) {
   console.log(event.detail);
   // event.detail contains:
   // - isSwitched: boolean - the raw switch state
   // - displayIncludingVat: boolean - whether prices now display including VAT
 });

Additional Information

For more information and other WordPress plugins, visit Wijnberg Developments.

Screenshots

  • This GIF demonstrates the main functionality of the plugin.

Blocks

This plugin provides 2 blocks.

  • Tax Switch text label Show text label whether prices include or exclude VAT.
  • Tax Switch for WooCommerce Switch for toggling VAT prices.

Installation

  1. Upload the plugin files to the /wp-content/plugins/tax-switch-for-woocommerce directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress.
  3. Use the WooCommerce -> Settings -> Tax Switch screen to configure the plugin.

FAQ

Are there any known compatibility issues?

Some WooCommerce Blocks are not fully compatible with this plugin as they do not use standard WooCommerce filters for price display. This is a known limitation of WooCommerce Blocks and not specific to this plugin. You can fix this by using WooCommerce shortcodes instead of the WooCommerce Blocks.

Why do prices stay the same after switching?

Sometimes prices may not appear to change when toggled. This is often related to WooCommerce tax settings. If possible, select ‘Shop based’ in WooCommerce Settings Tax “Calculate tax based on”. Otherwise, WooCommerce requires a billing/shipping address to calculate taxes, which is typically only available after login or during checkout.

Reviews

April 30, 2025 1 reply
Great plugin that does exactly what it says on the tin, I had an idea of how it could be improved for users, the developer didn’t only respond quickly to my forum comment, but then developed and included the idea within days . . . Really happy with how this works for me and strongly recommend to all.
February 13, 2025 1 reply
It’s an easy to use and universal plugin. In addition, the author’s support is fast and effective. I recommend it!
Read all 10 reviews

Contributors & Developers

“Tax Switch for WooCommerce” is open source software. The following people have contributed to this plugin.

Contributors

“Tax Switch for WooCommerce” has been translated into 1 locale. Thank you to the translators for their contributions.

Translate “Tax Switch for WooCommerce” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.5.0

  • Gutenberg block/shortcode for showing text about the currently selected tax setting. See this topic
  • Compatibility for Flatsome theme
  • Compatibility for FacetWP
  • Tested WooCommerce 9.8.2
  • Possible breaking change: refactored the (block) code structure to support multiple blocks

1.4.3

  • Tested WordPress 6.8.0
  • Tested WooCommerce 9.8.1
  • Security improvement: escaped dynamic class names in HTML output (reported by Peter Thaleikis).

1.4.2

  • Added compatibility for WooCommerce Quantity Discounts, Rules & Swatches

1.4.1

  • Added compatibility for Advanced Product Fields Pro for WooCommerce

1.4.0

  • Added shortcode generator

1.3.2

1.3.1

  • Tested with WooCommerce 9.7.1

1.3.0

  • Added ‘buttons’ switch type
  • Added Swedish language (special thanks to Martin Hult)
  • Added color setting for label text
  • Added JavaScript ‘wdevs-tax-switch-changed’ event

1.2.5

  • Fixed tax calculation if customer is VAT exempt

1.2.4

  • Always register the block/shortcode scripts and styles. Only enqueue them if the block or shortcode is executed
  • Fixed price display issues in Tiered Pricing Table for WooCommerce when shop prices are set to display excluding VAT by default

1.2.3

  • Added incompatibility list
  • Updated incompatibility for Unlimited Elements for Elementor (+ Pro)

1.2.2

  • Updated compatibility for WooCommerce Product Table Lite / PRO

1.2.1

  • Added compatibility for WPML

1.2.0

  • Disable the plugin in the WooCommerce mini cart widget

1.1.11

  • Added compatibility for Product Add-Ons for WooCommerce

1.1.10

  • Added compatibility for JetEngine Listing Grid ‘infinity scroll’

1.1.9

  • Added extra check for filtering backend and frontend AJAX requests (which adds compatibility for PDF Invoices & Packing Slips for WooCommerce)
  • Fixed a bug where the admin request checks failed when WordPress is installed in a subdirectory

1.1.8

  • Added compatibility for YITH WooCommerce Product Add-ons & Extra Options Premium

1.1.7

1.1.6

  • Removed applying ‘woocommerce_get_price_html’ filter a second time to prevent nested duplications

1.1.5

  • Added extra checks for only executing the filters on the frontend

1.1.4

  • Improved compatibility for Tiered Pricing Table for WooCommerce

1.1.3

  • Migrated filters from only using ‘woocommerce_get_price_html’ to ‘woocommerce_get_price_html’ in combination with ‘wc_price’. This way, the plugin should be more compatible with other plugins.
  • Added compatibility for Discount Rules for WooCommerce
  • Added compatibility for Tiered Pricing Table for WooCommerce on catalog pages

1.1.2

  • Added compatibility for Measurement Price Calculator for WooCommerce.

1.1.1

  • Added compatibility for Tiered Pricing Table for WooCommerce Premium (single product page).

1.1.0

1.0.1

  • Fixed bug where JS was not loaded when element was rendered by shortcode.

1.0.0

  • Initial release of Tax Switch for WooCommerce.