Code

WooCommerce Tax Toggle

WooCommerce Tax Toggle

3.40 (15 ratings) 3.40 stars
Cart 764 sales

The easiest way to toggle tax in WooCommerce!

Tax Toggle for WooCommerce plugin allows you to easily toggle between the taxed price and the untaxed price (i.e. show prices with and without tax).

Tax Toggle for WooCommerce allows the customer to select whether they want to view your WooCommerce products price including tax or excluding tax. The option chosen is saved to the users device so when the customer moves from page to page the prices are shown as per their selection.

The toggle is automatically added as a floating button on the left hand side of the site, but the toggle button can also be added as a Widget in a sidebar or it can be added anywhere (including in Gutenberg blocks or your theme) with shortcode [wootax].

For a better user experience, the WooCommerce Cart and Checkout behaviour are different from other pages. On the Cart page, the tax toggle shows/hides the tax and total order in the order summary. It does not toggle the individual items as this could be confusing for the customer.

On the Checkout the toggle is hidden because the tax is displayed as per the checkout rules. e.g. by what location is selected in the address.

The Tax Toggle uses the base country tax settings as per the WooCommerce tax settings section.

The plugin works and has been tested with the latest version of WordPress and WooCommerce. It works with the Classic Editor or Gutenberg Block Editor and works with WooCommerce Gutenberg Blocks. It has been tested with around 50 different themes, including the popular Storefront Theme for WooCommerce. If your theme is compatible with WooCommerce, then this plugin should work with it.

Key features roundup:

  • Simple – install and let your customers toggle on/off tax values!
  • Displays by default as floating toggle button
  • Toggle button can be inserted anywhere with shortcode, PHP code or using Widget
  • Text can be changed as needed – Tax, VAT, BTW – call it whatever you want
  • Set a default to automatically activate the toggle for new visitors
  • Easy to style with CSS as you want to suit your theme
  • Works with WooCommerce Product variations; works with Sale/Discounted items
  • Compatible with Gutenberg, WooCommerce Blocks, Storefront and many popular WordPress themes and plugins
  • Very quick and lightweight code – doesn’t affect performance of your site

Instructions for Install

Download the plugin zip file.

Go to WordPress Admin > Plugins > Add New Plugin > Upload Plugin, and upload the plugin zip file.

There are other ways to install the plugin, please see the WordPress documentation here (http://codex.wordpress.org/Managing_Plugins).

Once, installed, Activate the plugin. Tax Toggle will automatically display on the site.

For the plugin to work properly, you need to add some tax information to your WooCommerce settings:

  1. Tax Rates and Calculations must be switched on
    WP Admin > WooCommerce > Settings > General “Enable tax rates and calculations”
  2. Tax Rate must be set
    WP Admin > WooCommerce > Settings > Tax > Standard Rates + Insert Row with your Tax info
  3. Individual Product must be marked as Taxable
    WP Admin > Products > Product > Product Data > Tax Status > Product should be “Taxable”

Requirements

The plugin requires WooCommerce and WordPress to be installed.

You will also need to have your tax rates set in WooCommerce settings.

The plugin is compatible with Classic Editor, Gutenberg/Block Editor, and Elementor and other page builders using WooCommerce product display.

Using the Shortcode

You can use the shortcode [wootax] to insert the Toggle button anywhere you want in your theme.

Using the Widget

The Tax Toggle widgets can be added by going to Appearances > Widgets. You will find the tax toggle listed here as Tax Toggle. Drag this in to a Widget area and it will appear where you want it.

Using PHP

If you want to include the widget in your theme, use this for PHP insertion: <?php echo woo_tax_output(); ?> or <?php echo do_shortcode('[wootax]'); ?>

Tax Toggle Plugin Settings

Settings for the plugin are added to WP Admin > WooCommerce > Settings > Tax > Tax Options

Available settings are:

  • Floating Tax Toggle – Controls the visibility of the floating tax toggle.
  • Tax Button Text – Controls the language for the button text.
  • Tax Text – Controls the language for the name of the tax.
  • Default Tax Status – Controls whether the toggle is activated on first load for guest
  • Theme Override – Experimental. If your theme shows double pricing in some places, this may help fix it.

FAQ

Q: I’m not seeing any changes

A: Please double check your tax settings and your product settings to check you have the taxed and unataxed amounts correctly setup. By default WooCommerce does not include a tax rate amount. This needs to be setup in WooCommerce > Settings > Tax

Q: Can I translate the text?

A: The plugin is set up for the strings to be translated by popular programs such as WPML and Polylang. If you want to translate the strings for just one language, here is a code snippet to add to your functions.php file.

Q: Does this work with my theme? The plugin doesn’t display correctly with my X theme

A: Every theme is different, but if the theme is properly coded using WooCommerce coding standards then this plugin should work. If the plugin does not work out of the box, we provide a Theme Override setting to help make it compatible with themes that do things in a strange way, and we can provide assistance with any other themes using either PHP in your theme/child theme or JavaScript.

Change Log

Version 1.3.1 (2020-05-13)

  • Allowed for Zero Rated items to not display incl/excl tax text.
  • Minor documentation updates
  • Primary readme is now HTML file

Version 1.3 (2020-05-13)

  • Various bug fixes
  • PHP updates
  • jQuery 3.0+ updates
  • Compatible with Storefront Theme
  • Compatible with WooCommerce Gutenberg Blocks
  • Dropped reliance on FontAwesome for active toggle, now using SVG
  • Added small animation on toggle change
  • Experimental option to make more compatible with some themes
  • Added default status option
  • Improved documentation
  • Added admin notices if WooCommerce or Tax not enabled

Version 1.2.4 (2017-11-01)

  • Adjust cart tax display to fix itemised only showing
  • Adjust get_price function to replace depreciated WC functions

Version 1.2.3 (2017-07-17)

  • Debug fix

Version 1.2.2 (2017-07-17)

  • Cookie fix

Version 1.2.1 (2017-07-17)

  • PHP Loader added
  • Shortcode added

Version 1.2.0 (2017-06-05)

  • Rewrite of file structure
  • Compatibility with WC 3.0 hook changes / discontinued hooks
  • Rebuilt the variable product from: function

Version 1.1.4 (2017-04-11)

  • Bug fixed when simple product but no tax

Version 1.1.3 (2017-04-11)

Version 1.1.2 (2017-04-05)

  • Change the cookie method to work with WC 3.0
  • Cleaned some JS

Version 1.1.1 (2017-01-20)

  • Add translation example code function
  • Add more translations
  • Support variable decimal point positions
  • Support Currency Positions
  • Support various separator types

Version 1.1.0 (2017-01-04)

  • Made all strings translatable
  • Tidied code
  • Add span class to quantity to increase compatibility with dropdown carts on certain themes using JS to count QTY
  • fix https issue on some sites

Version 1.0.15 (2016-11-08)

  • Fix right to left currency symbol on variable product

Version 1.0.14 (2016-05-19)

  • Adds Currency Symbol to mini-cart / Fix

Version 1.0.13 (2016-05-18)

  • Fix to work with latest mini-cart

Version 1.0.12 (2016-05-09)

  • Update for new WP – Fixes Variation non-sale being £0

Version 1.0.11 (2016-01-31)

  • Regular / Sale Fix
  • Sale on variation update
  • Widget text as per settings

Version 1.0.10 (2015-12-22)

  • Rounds numbers as per the WC settings
  • Doesn’t display the toggle for non-tax items
  • Shows both regular and sale price (with line-through)
  • fix notice for $wootext

Version 1.0.9 (2015-09-17)

  • Displays correctly for custom decimal points set in Settings

Version 1.0.8 (2015-09-14)

  • Updated Currency Position for right sided currencies

Version 1.0.7

  • Customise the Toggle Button text in the settings. Default will be Includes + TAXTEXT
  • Set’s default setting of tax included or excluded based on WooCommerce settings

Version 1.0.6

  • Fixed currency bug with sidebar cart.

Version 1.0.5

  • Compatible with WP 4, WC 2.2 and fix jQuery VAT addition on non-UK sites

Version 1.0.4

  • Added From: to prepend to Grouped and Variable products so it indicates a range

Version 1.0.3

  • Added ability to edit the VAT text in WooCommerce > Settings

Version 1.0.2

  • Fixed no appearance on some themes
  • Geographic beta work started

Version 1.0.1

  • Small change to rename as Tax Toggle and not VAT Toggle
by
by
by
by
by
by