Our other plugins










Join almost 500 EDD sites using this plugin to add EU VAT support to their shop.
“The EU VAT support for EDD and companion EDD VAT-MOSS reporting plug-ins have been of indispensable value to ease dealing with the EU VAT-MOSS regulations when selling to all kinds of customers over Europe and the rest of the world.
“Support by Lyquidity has been exceptional, very fast and to the point, answering any question. They even took the effort to update the VAT-MOSS plug-in to add support for the (optional) EDD Discounts Pro plug-in. Highly recommended!”
Matthew Lane, www.mathewlane.com
“As a technical person company finances are never something I look forward to. To make things worse the 2015 VAT rules introduced a lot of complications and overheads. Like many other small businesses I was thinking of calling it quits until I heard of WP Route. Their WordPress plugins integrate seamlessly with my Easy Digital Download shopping cart and automate all the VAT kerfuffle for me.
Their support was also very helpful and give a personalized service. I wholeheartedly recommend their plugin.”
Robert Abela, www.wpsecurityauditlog.com
“Many thanks for this GREAT plugin! Well worth the money, and simple to set up. Congrats and good luck … ”
David A. Glen, Publisher & Managing Director, Creative Storytellers
“What a great product! Once I saw the videos, I could see that it covered just about every aspect of this VAT mess that was needed. I’ve already started recommending it to others.
Having this plugin has allowed me to reconsider shelving the series of premium articles that I was holding off on, due to the previous lack of ability to sell it with the correct VAT applied.”
Gary Jones, Web Developer, Gamajo Tech
What you get: The plug-in and updates for 12 months.
Download EU VAT support for EDD PDF
The plugin requires PHP 5.3 or later (works with PHP 7.0 or later).
It is tested with EDD up to version 2.9.26 and with WordPress versions up to 5.5.3
VAT rules are more complex than simple sales tax rules and this plugin adds features to Easy Digital Downloads so companies based in the EU, and which use EDD, can apply VAT correctly.
From January 1st 2015 all companies any where in the world that sell digital services to a purchaser in one of the EU member states will be required to register with the tax authority of any one of the EU member states then collect and remit VAT to that tax authority.
VAT reporting for EDD reports to Excel
VAT for EDD Checkout (supports 2015 rules)
“Being new sellers in France, the EDD VAT plugin have been a great help for us to manage the taxes without programming skills. A must have for Easy Digital Downloads users wishing to sell in Europe.”
Matthieu A
“The new EU VAT rules change the game, and thanks to VAT Support I can easily comply.”
Peter Scheelke
https://www.promates.com/music-store/
“I’ve been hugely impressed with both the functionality and support of the EU VAT plugin for EDD. I’ve found your plugin really straightforward by comparison. My client was delighted when I told them that it support VIES lookup.
The support provided has also been exemplary. Your rapid and persistent response has been great and such a marked contrast with others, especially in mind of the small cost.”
Brian Milnes
“What a great product! Once I saw the videos, I could see that it covered just about every aspect of this VAT mess that was needed. I’ve already started recommending it to others.
Having this plugin has allowed me to reconsider shelving the series of premium articles that I was holding off on, due to the previous lack of ability to sell it with the correct VAT applied.”
Gary Jones, Web Developer,
“Many thanks for this GREAT plugin! Well worth the money, and simple to set up. Congrats and good luck … ”
Publisher & Managing Director,
Version 1.5.25: 2020-12-04
Changed to add the country code 'EL' which is the VAT identifier for Greece. Previously only the ISO country code (GR) was included.
Updated to change a ternary parenthesis structure that was disallowed in PHP 7.4
All to function edd_get_shop_currency was called without parentheses which is now disallowed in PHP.
Version 1.5.24: 2020-04-01
New settings option will allow a site to register VIES VAT number validation failure but accommodate them.
Version 1.5.23: 2020-03-15
Fixes a problem when multiple payment methods are used. In this scenario the link to show the VAT details fields fails to work because these elements are loaded *after* the JavaScript even though the JavaScript is not loaded until the document is ready.
Version 1.5.22: 2020-01-19
Added support for the change to the use of MaxMind GeoIP2 databases that now require a license key (still free)
Added support for checking NL sole proprietor numbers.
Version 1.5.22: 2019-12-02
Added suppport for VAT exempt countries.
Added validation of the structure of VAT numbers as they are entered on the checkout page.
Version 1.5.22: 2019-01-30
Removes calls to error_log() from the MU updater.
Fixes an error in shortcode.php that affects filter 'edd_get_download_price'
Adds call to filter 'edd_cart_item_price_label' in 'vat_cart_formatted_item_price'
Change the priority of filter 'edd_cart_item_price' to 100
Version 1.5.21: 2018-10-10
Fixes another issue arising from the change to the use of nonces in EDD 2.9.4. In this case the cart did not update after entering a VAT number.
Version 1.5.20: 2018-07-11
Fixed two errors caused by an undocumented change to the EDD billing template in EDD version 2.9.4. One removes the cart when the billing country is changed. The other removed the state field when the billing country is changed.
Version 1.5.18: 2018-07-10
There are breaking changes in EDD 2.9.4.
We recommend you do not update at this time.
At the moment changes in EDD to improve security in EDD 2.9.4 break the VAT plugin as the cart does not operate correctly. This issue is under investigation but at the moment a fix is not available.
Update to the checkout_cart.php template to add support for the nonce check introduced in EDD version 2.9.4.
Version 1.5.17: 2018-06-04
Added support for
GDPR by adding VAT information to the output generated by the EDD support for the WordPress GDPR personal information review feature.
Version 1.5.16: 2017-01-
26
Moved the option to enable 2015 rule to the main page of the tax es settings so new users do not forget to set the option.
Updates to the checkout cart template to reflect changes in recent versions of EDD.
Includes the SKU in the product title if an SKU is defined
EDD does not show product prices including VAT on product (download) pages. This version adds an option on the settings page to present product prices including VAT.
Adds a new settings option that allows built-in invoices to be shown even when the user is not signed in as long as they have a valid link. This is useful for sites that do not require users to explicitly register.
Added support for CloudFlare IPv6 -> IPv4 mapping. When mapped this way it is not possible to associate the IPv4 address with a country so CloudFlare includes the country code as a header. This feature can be enabled by implementing a filter called 'edd_vat_use_cf_ip_header' which should return a 'true' value.
Fixes log warning messages that appear because the 'bulk_actions' function of the VAT reports classes was not defined correctly.
Version 1.5.15: 2016-10-30
Fixes a bug in the new invoice feature that causes the name and price shown for the last item to be the same as the second last item.
If a user added rates of 0% to the tax rates table for EU regions that are not subject to VAT such as the Canary Islands the rate would be set to the country when updating. These are now not updated.
Version 1.5.14: 2016-10-30
Update the invoice template to support long shop company names. Names names will be split when a hyphen is found and each part will be shown on a separate line
Fixes a missing VAT rate lookup case. If a non-EU country has a rate, that rate should be applied but the default rate (usually zero) has been applied instead. Until now.
Added a new feature to generate an HTML invoice. This new feature will not appear the EDD PDF Invoices extension or the EDD HTML invoices extension is active. See the VAT plugin documentation page for more information.
Refactored the 'js', 'css' and 'images' folder to exist under a new 'assets' folder.
Version 1.5.13: 2016-10-08
Internal release
Version 1.5.12: 2016-08-08
Updated the IP location map to use V3 of the Google Maps API.
If sites have a key (free) for Google Maps API it can be applied using another new option. Adding a key means site visitors do not see a warning in their browser console window.
New settings option added to allow an administrator to force the site server to use HTTP when retrieving VAT rates. Some sites now actively block protocols supported by IIS.
Added another test to reduce the times the get-text function implemented by this function is called.
Updated the checkout cart template to include the 'edd_checkout_cart_item_title_after' filter introduced in EDD 2.6.
Fixes a problem introduced in 1.5.11 that can cause billing and VAT fields to appear on the checkout page twice when templates are overridden.
Version 1.5.11: 2016-05-04
Fixes an issue in the checkout cart template that assumed an element called 'options' will always exist in cart items.
Fixes an issue that prevents the checkout cart or checkout billing template being used as a custom template.
Added a guard to the ip address option passed to the edd_vat_location_info to prevent it being used as an attack vector.
Updated the purchase_link shortcode to display price including tax if appropriate.
Update to limit the initial VIES check to occur only when the taxes settings page is displayed. Previously it occurred on all settings pages which is problem if outbound connections are not permitted because the timeout period can be extensive.
Version 1.5.10: 2016-03-22
Modified vat-fields.php to change an id to make it unique. The existing name meant it was difficult to style the VAT fields.
Added support for visitors appearing via CloudeFlare proxy. The client IP address appears in a different header.
Fixed a bug that prevents the VAT fields appearing if a buyer from outside the EU selects an EU member state as a billing country.
Version 1.5.9: 2016-01-12
Updates to support EDD 2.5 including placing the VAT options in their own section. MUST use EDD 2.5.4 or later.
EDD 2.5 has includes backwards incompatibility that affects the VAT number saved when entered on the taxes settings page. The number is not retrieved so the next time the settings are saved the number is removed.
If more than one IP address appears in the page request ignore any that are from any private class such as 10.x.x.x or 192.168.x.x
Now uses the edd_get_option() function rather than the global $edd_options when accessing the name of the checkout, success and purchase history pages. This enables integration with PolyLang.
Added support for the new 'sections' available on setting tab pages with EDD 2.5
Version 1.5.8: 2015-11-22
Resolves a problem causing a fatal error to occur after a license is de-activated.
Fixed an issue preventing the IP address link working when the WordPress admin link is not the default /wp-admn.
Version 1.5.7: 2015-11-17
Fixed a problem introduced in 1.5.6 that affects sites that do not display the VAT fields. In this scenario the self-certification check-box is not shown when a billing-country that is not the IP address country so the checkout validation cannot succeed.
Version 1.5.6: 2015-11-15
Update to support the text domain used since EDD 2.4.7.
Update to make sure that when the vat fields are disabled they are not re-displayed when the country is changed.
Update to make sure the MaxMind database reader classes are only loaded if another plugin has not already loaded them.
The VAT by country report has been updated to sort by the tax column correctly.
The VAT sales list has been updated to sort by the currency column correctly.
Version 1.5.5: 2015-07-28
Update to client-side javascript to better handle strict mode.
Change to VAT rate classes to allow a zero rate.
Version 1.5.4: 2015-05-03
Fix to a badly implemented change to prevent hacking. The bad change meant licenses cannot be activated or deactivated.
Version 1.5.3: 2015-04-26
Added support for both physical product VAT rules and digital product rules. Previously the plugin would support one or the other but not one rule for one product and the other for another.
Updated the plugin in line with the WordPress advice to escape the use of thr add_query_args function.
Change to use admin_url() where appropriate.
Change to reduced the number of time a check is made for new VAT rates.
Change links to reference wproute.com.
Version 1.5.2: 2015-03-26
Fixes a VAT number validation failure if the company name includes an apostrophe.
Version 1.5.1: 2015-03-03
Modification to show the correct VAT on Fees when multiple VAT classes are being used and a cart contains products with more that one rate (say a book and a software product)
Change to settings.php to suppress a warning message when PHP 5.4 or later is used.
Version 1.5.0: 2015-02-23
Update to allow a user to specify an EC rate type for a VAT rate class.
Update to the VAT report by country to accommodate a change introduced in EDD 2.3.
Updated the VAT Details panels on the View Order Details page to report tax by VAT rate percent.
Version 1.4.3: 2015-02-02
Fixed a problem introduced in 1.4.2 that prevented prices showing on buttons.
Version 1.4.2: 2015-02-01
Fixed a legacy problem which resulted in the incorrect calculation of tax when using prices inclusive of tax and the product is purchased outside the EU.
Updated Actions::get_ip_country() so it can be called to access the IP address of a country passed as a parameter.
The VAT rate is now recorded against each line item so that these potentially different rates can be included any MOSS report.
Fixed a problem preventing the correct GeoIP display for the IP address shown in the View Order Details page.
Prevented the display of a tax rate when a free product is selected.
Version 1.4.1: 2015-01-04
Fixes a problem arising due to an API change in EDD 2.1 that causes the plugin to display the wrong item price when the price is entered with tax.
Version 1.4.0: 2014-12-30
Adds support for multiple rates classes and assigning a class to a download. Using this feature a site is able to sell a software product at the standard rate of any EU member state but sell an e-book using an e-books rate applicable in a member state or the default standard rate if there is no special e-books rate in a member state.
Saves the VAT rate applied to a sales into the cart details.
The VAT rate is displayed in the VAT sales report and included in the export.
Version 1.3.2: 2014-12-23
Updated the function to display variable prices to accommodate a function change in EDD.
Replaced the use of file_get_contents() with wp_remote_get() so it is not necessary to modify the php.ini file to retrieve VAT rates.
Version 1.3.1: 2014-12-22
A new feature allows the plug-in to restrict sales to consumers in the EU while still permitting sales to businesses.
Moved hard-coded styling in vat_fields.php to the plug-in stylesheet.
Version 1.3.0: 2014-12-19
Added the ability for the plugin to show the country of the users IP address as the default country at checkout.
Modified loading of the language domain to support its use with WPML.
Version 1.2.9: 2014-12-14
Fixed an incorrect test when checking the country held in the user's profile.
Fixed a problem when using the GeoIP 2 functions on a local network. The GeoIP 2 functions cannot report a country for 192.168.0.x but the exception raised was not caught.
Version 1.2.8: 2014-12-09
Fixed a possible conflict with other plugins over the name of a function used by the new GeoIP 2 functions. (If you are on 1.2.7 and everything work OK, you probably don't need this update)
Version 1.2.7: 2014-12-04
Prevented a purchase on EU-based site by a non-EU person for another non-EU person attracting VAT.
German translation files updated>
Version 1.2.6: 2014-11-29
Add check box to enable 2015 rule change support
Includes support for IP information lookup that does not depend upon the PHP GeoIP extension or access to an external web site.
VAT is now applied to sales from an EU IP addresses even when the billing addresses is a location outside the EU and the buyer is asked to self-certify.
Displays an admin notice when VAT rates are updated on the Lyquidity web site
Fixed a problem that meant a zero VAT rate from regions like the Canary Islands was not applied
Fixed a problem that prevented the IP address details map displaying when the site is using HTTPS.
The plugin folder can be changed to have more than one version of the plugin at in the plugins folder as the same time (though only one can be activate).
Version 1.2.5: 2014-11-26
Replace the use of Thickbox to present IP address information with a jQuery dialog box which provides a better appearance than Thickbox (which in WordPress is hard-coded to use a specific size window).
Fixes a cosmetic issue that cause the display of IP address information to replace the whole page when users have the opportunity to select a payment gateway instead of appearing in a pop-up as intended.
Fixes a problem with the option to reposition the VAT fields which placed the fields above any payment gateways. This placement did not affect the the validation of a VAT number but did cause both 'validated' and 'not entered' message to appear at the same time.
Version 1.2.4: 2014-11-24
It is now possible to hide the IP address on the checkout page if it is not necessary for you to display it.
The location of the VAT fields within the purchase form can be set to be the top of the form, the bottom of the form or the default, current location.
It is now possible to import VAT rate for all EU member states from rates maintained on our site using a new option in the VAT settings. Because from Jan 1st it is necessary to use the rate of the country of supply, this will make it easier to keep your VAT rates correct.
Fixed a problem with the price on shop price buttons not including tax when tax should be included.
Version 1.2.3: 2014-11-20
Completely revised de-DE language file thanks to Carsten Scheuer of inveris.de
The buyer's IP address on the View Order Detail page now has a link which will show the country and currency associated with the IP address. It also uses the Google maps API to show on map the resolved location based on the recorded latitude and longitude registered with the IP address.
Similar information is available for the IP addresses shown on the VAT Sales List and VAT Sales by country reports.
Version 1.2.2: 2014-11-18
Added support for GeoPlugin.net so IP address details can be accessed without needing the PHP GeoIP extensions which may not be available on shared hosts.
Version 1.2.1: 2014-11-
16
Added VAT number, IP address and self-certification status (the evidence required by the 2015 VAT digital services sales rules) to the EDD payment history export report.
Fixed a bug which required self-certification incorrectly.
Version 1.2.0: 2014-11-14
This is an exciting release which implements the features you need to support the VAT rule which come into effect on Jan 1st 2014.
The plugin has always supported different VAT rates for EU member states and working out whether the buyer is a business or a consumer.
But this version collects the evidence you must use to determine the country of supply and, so, the VAT rate which must be applied: the country f the IP address and the country of billing address.
If there is a difference between the two, the consumer will be asked to 'self-certify' in order to confirm the country of billing address is the one to use to determine the correct rate to supply.
A new report allows you to see consumer sales by country, the VAT amount charged and that rate applied. This report provides the information you need to create your MOSS VAT submission.
Version 1.1.9: 2014-10-30
Internal version never released
Version 1.1.8: 2014-09-05
Change to accommodate a change to an EDD filter used by the plugin.
Version 1.1.7: 2014-07-15
Improved support for GST
Fixed a problem with the calculation of tax in the VAT template.
Fixed a problem with item price after extreme discounts such as 98%
Version 1.1.6: 2014-07-11
Minor fixes so an alternative tax name, such as GST can be used.
New option to hide VAT fields. This means when used with GST where tax must always be collected, the field need not be shown.
Version 1.1.5
Skipped
Version 1.1.4: 2014-04-22
Added optional support for the forthcoming sequential invoice numbering system.
Version 1.1.3: 2014-04-20
Fix to remove a warning message about missing argument the get_tax_rate() function.
The VAT fields HTML is now a template so it is now possible to completely re-style the field. See the documentation for more information.
The message following a VAT number validation change stays visible for 5 seconds.
Updated the checkout button code to mirror updates in the core EDD.
Made a change to prevent a warning message about missing variable $label and a separate one about $price.
Increased the timeout of the blue information both a user see after successful VAT number validation because it was disappearing too quickly.
Version 1.1.2: 2014-03-30
Fix to accommodate a change in 1.9 that meant the base VAT rate was not save and would always take use default value of 20%
Change to support the display correct cart items prices, sub-totals and totals whether prices include tax or not, prices are to be shown including tax or not and whether tax is payable or not.
Fixed a problem with the VAT sale list which did not filter on month correctly.
Removed PHP warnings of an undefined variable 'label'.
Fix to prevent an error when using IE 10/11.
Version 1.1.1: 2014-03-23
Removed support for EDD 1.8.x. This version computed some taxes incorrectly and improving this was an objective of 1.9.x. As a result, the shortcode_receipt template override has been eliminated.
Fixed a problem which could occur when two copies of jQuery are download (for example, from WordPress but also from a theme).
The 'VAT' name displayed by the plugin can now be set using an setting option.
The text used to display the VAT/tax rate used can be defined using settings. Now you can define the text displayed when taxes are included/excluded and when no tax will be applied.
The 'company name' returned by the VIES web site when the entity is a sole trader is non-standard. For example the name for a German sole trader will be reported as 'xxx'. This specific case is now handled. To allow you to handle any other scenario a new filter has been implemented. Information about the filter is available in the documentation.
Version 1.0.29: 2014-03-09
Fixed a problem that prevented the JavaScript downloading unless the checkout page is called 'Checkout'. Now it respects the EDD checkout page setting.
Added a filter to allow a site to validate the VAT company name entered by a user more flexibly according to your own criteria. See the documentation for more information about the filter called "preprocess-vies-company-name".
Different people have different ideas about how the text shown against, say, the checkout button should appear. A new filter has been added so a site is able to construct its own text. See the documentation for information about the filter 'edd-vat-tax-rate-display'.
Version 1.0.28: 2014-03-07
Fixed a problem that caused the VAT panel to display when two (or more) non-VAT countries were selected in succession.
Updated to show 'Tax' when a non-VAT country is selected even if the account holder's details indicate that are from an EU state.
Version 1.0.27: 2014-03-02
Fix a problem validating some NL VAT numbers (ones with a letter and two digits on the end).
Version 1.0.26: 2014-02-27
Add a dependency on jQuery to the plugin's JavaScript.
Fixed a problem with the option to force VAT to be charged in the country of the vendor.
Version 1.0.25: 2014-02-17
Small fix to correct the translation of 'Excluding x% VAT' on the product download page.
Version 1.0.24: 2014-02-14
Removed the dependency on the BCMath library after remembering some school boy maths.
Version 1.0.23: 2014-02-12
Fixed problems affecting the validation of some CZ, FR, IT, SE, RO and SK VAT numbers.
Version 1.0.22: 2014-02-05
Fixed a EDD 1.9 compatibility problem affecting email receipt production which causes a PHP warning message.
Changed the presentation of the VAT fields so they are hidden if there is no existing VAT number. Instead the behavior is similar to the discount code as a message is shown with a link that when pressed reveals the VAT fields.
Version 1.0.21: 2014-02-03
Updated to handle the display of VAT information as discounts are changed and to ensure the VAT number is shown validated whenever possible.
Version 1.0.20: 2014-02-03
Fix to remove an error when either a VAT number is reset or a discount code is applied by a guest.
Version 1.0.19: 2014-01-24
Fix to license activation to accommodate internal change in EDD 1.9.x.
Version 1.0.18: 2014-01-10
It is now possible to edit the VAT number and company name on the purchase history details page.
Version 1.0.17: 2014-01-10
Added VAT number and company name to the user profile.
Version 1.0.16: 2014-01-08
Updates to work with 1.9 final release.
Version 1.0.15: 2014-01-04
Updates to enable operation with 1.9 beta. Also a change to work with IE 11.
Version 1.0.14: 2014-01-02
The invoice showed € when the EDD currency is €. This patch updates the VAT PDF template so the correct symbol is emitted.
Version 1.0.12: 2013-12-27
Fixed the fix.
Version 1.0.11: 2013-12-27
Fixed a problem validating a VAT number from a server with IPv6 enabled. The VIES IPv6 proxy *requires* the headers of a SOAP request include a user agent. By default the PHP SOAP client does not include this information which is not required by the IPv4 proxy.
Version 1.0.10: 2013-12-20
Added warnings to indicate to an administrator when the VIES system cannot accessed by the server hosting WordPress.
Changed the way payments method changes are detected to work with more versions of jQuery.
VAT fields are generated in response to the CC actions not the user actions. This is necessary so the VAT fields will always be displayed and so they are presents *after* the address fields.
Added an extra PHP file which allows the accessibility of VIES to be determined without using WordPress.
Version 1.0.9: 2013-12-18
Changed the location of the VAT fields so they appear after the CC fields.
Version 1.0.8: 2013-12-16
Small change for compatibility with WP 3.8
Version 1.0.7: 2013-12-13
Added the ability to disable the company name check
Version 1.0.6: 2013-12-13
Fixed a problem validating DK VAT Numbers
Version 1.0.5: 2013-12-04
Updated to hide VAT number when the cart total is zero.
Version 1.0.4: 2013-12-04
Fix VAT number simple checks and made simple checking optional
Version 1.0.3: 2013-11-24
Support for MaxMind GeoIP functions if they exist
Validate that a user has selected a country
Version 1.0.2: 2013-11-21
Added PDF and Email templates
Replace EDD item price, sub-total and tax calculation because they are broken (acknowledged by EDD)
Added option to always charge VAT if the buyer is in the same EU member state.
Version 1.0.1: 2013-11-20
Initial release
New VAT rules starting Jan 1st 2015
EU VAT rules are changing from 2015, changes which affect anyone who sells telecommunications and digital services to people within the EU. This section is a non-authoritative review of the change that may affect your site. For an authoritative review visit the web site of one of the EU member state tax authorities. Our tax authority is the Her Majesties Revenue and Customs (HMRC) and information about the change can be found here: VAT: Supplying digital services and the VAT Mini-One-Stop-Shop (MOSS).
What is a digital service?
Digital services are the kinds of things you buy over the internet or through some equivalent telecommunications media which include video streaming, e-books, mobile apps, software to download and on-line training. So the rule changes do not affect sites that sell thing that have to be shipped because they cannot be accessed and used electronically
Business-to-Consumer
The biggest impact of the change is to vendors providing digital services to consumers. Before the rule changes a vendor is able to charge VAT using the shop’s domestic VAT rate. This makes it simple for the vendor. After the change it is necessary for the vendor to charge VAT at the rate where the buyer resides.
Business-to-Business
There are few changes affecting Business-to-business sales. Many of the changes affecting B2C sales already apply to B2B sales. VAT is still not charged and is accounted for by the buyer through the re-charge mechanism. The most significant change is that purchasing businesses must always account for VAT at their domestic rate.
Registering with tax authorities
Every entity that sells digital services to EU citizens or businesses needs to register with the one-stop-shop provided by the tax authorities of the country in which they operate. In most cases this will be one registration.
Non-EU businesses
All entities, even non-EU business, that provide digital services to EU citizens are required to register with an EU tax authority. This is because they are required to charge, collect and remit VAT. If you are a business based in the US then if you might sell your digital service to someone in the EU you are required to follow these rules. It’s not clear how this requirement can be enforced.
What do you need to do?
So applying the correct VAT rate is one issue. The other is that you must be able to prove that the VAT rate used is correct. To prove you are using the correct VAT rate you need two pieces of non-conflicting evidence to corroborate your decision. The VAT rules specify a list of possible pieces but the obvious ones are the country of the billing address and the country of the IP address. The VAT rate and the information used to decide on the amount of VAT to charge must be kept for 10 years.
How this plugin helps you cope with the new VAT rules
Capturing evidence
The VAT plugin will allow you to collect the billing address, and so the country, of the purchaser and the IP address of the browser and so a second piece of evidence about the country of the purchaser.
Validating evidence
The plugin will compare the country of the billing address and country of the IP address to confirm they are the same. In this way you have the two required pieces of evidence.
If the countries do not match the buyer will be prompted to confirm the country of the billing address is the correct location of supply. The confirmation, known as self-verification, is also recorded and constitutes the alternative second piece of evidence.
Applying the correct VAT rate
The plugin allows a VAT rate to be specified for each EU member state. The verified country of billing address is used to select the rate to be applied to the sale.
Capturing the VAT number
For B2B sales VAT does not need to be charged if the buyers VAT number is collected. The plugin supports capturing and verifying the captured VAT number.
Best of both worlds: Sell but only to EU businesses
Some vendors, especially but not only non-EU businesses, will want to restrict sales to EU consumers because these sales require that even non-EU businesses register for VAT with the tax authority of an EU member state. But those same vendors probably want to continue selling to EU businesses because different rules apply and these sales do not require VAT registration.
For these users, such as US vendors that want to sell to EU businesses, the plugin has a settings option to allow just this behavior.
Check the box and buyers from the EU (determined by the country of the IP address and the country of the billing addresses) will be able to buy your digital service only if they enter and validate an EU VAT number. When this option is enabled any visitor who attempts to complete a purchase without entering a VAT number will see a details validation message much like they see if their address is missing or the terms and conditions have not been agreed accepted.
The following table summarizes the effect of this option. In/Outside EU is the location of the buyer not the vendors store. ‘VRN’ is ‘VAT Registered Number’ (or VAT Number).
Buyer’s IP | In EU | Outside EU | Buyer’s address | In EU | Outside EU | In EU | Outside EU |
---|---|---|---|---|---|---|
VRN (B2B) | OK | Not permitted1 | OK | N/A | No VRN (B2C) | Not permitted | Not permitted | Not permitted | N/A |
1) Sales to buyers purchasing within the EU on behalf of a company located outside the EU still attracts VAT because it is not possible to distinguish automatically between a non-EU business and a non-EU consumer. As a result the plugin prevents non-EU purchases from within the EU when this option is enabled.
Why is the visitor's IP address important?
Before January 2015 vendors charge VAT at the rate of the countries in which they are incorporated. For most companies, this means one country and therefore one rate. From January it becomes necessary to charge consumers VAT at the rate in their own country.
If you sell a physical thing then you will have a shipping address to which goods will be sent and this address can be used to justify applying VAT at a specific rate. But when selling a digital service, the billing address a user enters could be anything and might not be related to the purchasers actual location. This could be especially true of buyers from countries with a relatively high VAT rate such as Hungary (27%) who might like to pretend they are from Luxembourg (15%).
For on-line sites, then, it becomes necessary to use some other means to validate the buyer declared billing address. One way to validate the user’s location is to use the country associated with the IP address of machine they are using. This address is available to your web server and can be compared to a database of IP addresses to determine the country associated with that IP address.
If available, the plug-in will automatically use the PHP GeoIP extension functions of your web server to determine the country from visitor’s IP address. If the PHP GeoIP functions are not available, the plugin will automatically fall back to use information available through this site: http://www.geoplugin.net/
.If you are a vendor based in an EU member state, you should consult your tax authority or your accountant. The rule of thumb is that if you are selling to an end-user, then from Jan 1st you will probably need to collect VAT. If you are selling to a company then probably not.
Every vendor based in an EU member state must collect VAT on each sale unless the vendor is registered with a VAT scheme of a member state and is selling to a purchaser who: can show they are not a citizen of an EU member state; and who does not represent a company based in an EU member state.
For example, if a US citizen buys a product from a UK based vendor using a credit card with a US address the UK based vendor would not need to collect VAT. However if the same US citizen buys a product from a UK based company on behalf of a company registered in Germany then the UK company may need to collect VAT. If the buyer is a company registered in the EU and the buyer is able to show they are registered in a VAT scheme of an EU member state by providing the vendor with a valid VAT number then VAT does not have to be collected by the vendor. If the buyer is unable to provide a valid VAT number then VAT must be collected. The buyer will be able to claim the VAT back if they are, in fact, registered for VAT.
Businesses selling to EU consumer from anywhere in the world should collect and remit VAT to one of the EU member states.
All non-EU businesses that sell to EU consumers (not verifiable businesses) should register with an EU member state tax authority then collect and remit VAT payments.
Why would a non-EU business do that? Will the EU prosecute non-EU businesses for failure to comply?
My guess is probably not, but if the business grows and later decides to incorporate in the EU or decides to sell itself and must enter a period of due diligence, failure to comply with the EU rules on VAT is likely to result in an unexpected tax liability.
Should I register with a VAT scheme?
This is a question for your accountant but broadly the answer is that if you are a business or an individual selling to businesses or individuals in the EU, yes. For UK businesses there is information on the HMRC web site. Tax authorities of other EU member states have similar information available.
Vendors based in the EU must register to join the VAT scheme of the appropriate member state if their revenues in the past 12 month are above an amount specified by their tax authority. At the moment this amount is in the region of €90K though it is revised every year. If a vendor is based in the EU but is not a member of a EU member state VAT scheme then VAT should be collected unless exceptions apply. If a vendor is not a member of a VAT scheme then VAT should not be charged on sales to other EU citizens or to companies registered in an EU member state.
When registered with a VAT scheme there is a statutory obligation to submit a VAT return each quarter so being registered means there is paper work to do. However if you are making many sales then sooner or later you will need to register with a VAT scheme so you may as well register sooner and get a process in place. If you are in start-up mode and not making many sales but are buying goods and services, a reason to register with a VAT scheme is so that you are not charged VAT or, if you are, you can reclaim the VAT.
Note that if you sell above a threshold amount to any other EU member state you may also need to register with the VAT scheme in those countries.
The plugin is installed the same way as any 3rd party plugin: download the plugin zip from your account after purchase; use the WordPress plugin manager to upload and install the plugin.
The place to start is on the ‘Taxes’ tab of the EDD settings page. As normal, specify your ‘base country’ – presumably one of the EU member states – but set a default tax rate of zero. This will ensure you are not collecting VAT when its not appropriate. If you are required to collect tax from sales to some non-EU countries you can add a tax rate for these countries explicitly.
Make sure you set the option to compute taxes after discounts are applied,
Next, scroll down to the ‘VAT settings’ section of the ‘Taxes’ tab. Enter your company name and your VAT number and press the ‘Validate’ button. You cannot collect VAT until you have entered a valid VAT number. The VAT number will be checked automatically with the EU commission’s ‘VIES’ web page. The validation process will confirm the number is valid and also that the company name associated with the number is the same as the name you have provided.
The VIES sites does not always respond or responds with an error code. If this is a problem you experience, check the option to disable the attempt to verify the VAT number entered by a buyer. When checked the plugin will still allow a buyer to enter a VAT number but the check performed is that the structure of the number given is correct. The potential VAT number GB123456789 is the correct length but the sequence of digits is not valid.
The next configuration step is to enter all the EU countries you sell to. There’s a button to add all 28 EU member states in one go. Enter the VAT rate for your member state then press the button. Each country will be set to use your VAT rate. This is normally correct though if you are registered with VAT schemes in other countries you will need to enter their prevailing rate for those countries. For example, a UK company would (at the time of writing) use a default rate of 20%. However if that company is also registered with the VAT scheme in Germany, the default rate on the row for Germany would need to be changed to 19.5%.
The tax amount shown in the shop front builds on the EDD core by forcing the VAT rate to zero if the user has a VAT number associated with their account.
WordPress nor EDD have a concept of a VAT number or company. You can choose to use the feature provided by the plugin or override the ‘get-vat-number-custom’ and ‘get-company-custom’ filters. By overriding the filters you are able to store these value where you like.
There are three features the plugin adds to the check: the ‘tax’ is shown as ‘VAT’ when the purchaser is from an EU member state; the ability to collect and validate a VAT number; and display VAT if a visitor from a non-EU state selects a country that is in the EU.
Cart
VAT number
If a buyer from an EU member state does not have a VAT number associated with their account they can add one while in the cart. Any number entered will only be accepted (and the purchase can only proceed) if it is validated. The option to enter a VAT number and company does not appear when the country associated with the user is not an EU member state.
When the VAT number is validated (or a number is removed and validated) the cart tax calculations are updated automatically.
Country
The country shown is the EDD country associated with the user’s account or, if there is no country, the country of the store. You can change how the country is retrieved by intercepting the ‘get-country-custom’ filter. On our site we take advantage of this option to change the default country. EDD uses the country of the shop as the default. However we want to use country of the IP address of the visitor.
If the country changes and the selected country is an EU member state (and the option to enter a VAT number is not currently presented) it is shown. If the country selected is not an EU state, the option is removed. If necessary the tax shown in the cart is updated.
The receipt template has been updated to display VAT information if the purchaser is in an EU member state.
The plugin supports two forms of invoice generation. One is a template for the popular PDF Invoices extension for EDD that generates PDF based invoices directly and which focuses on the needs of sites that must meet the requirements of the EU VAT directive. You can read more about support for the PDF Invoices in the section titled ‘PDF and Email’ below.
HTML Invoice generation
This plugin also supports the generation of an HTML-based invoice that users see in their browser and can print or save to PDF.
While only one style is provided, the invoice is template-based so you are able to define your own template to create invoices with a style is consistent with your website.
This feature is not enabled while another invoice tool is active.
Euro equivalent
The tax authorities of some EU member states require that invoices for products purchased using a currency other than the the currency of the buyer’s domestic currency include a Euro equivalent and this feature supports this requirement. For example, a site based in Spain might sell in USD because this is the largest market. If a buyer from France makes a purchase the buyer will see an invoice quoting the USD price. However the site owner has the option to include an equivalent EUR price based on the exchange rate for the purchase date provide by the European Central Bank (ECB). Obviously this is only a guide as the actual exchange rate used by the payment processor may not be available to the site.
The plugin includes replacements for the ‘checkout_cart’ and ‘shortcode_receipt’ templates. The plugin will use these templates even if you have replaced them in your theme. This is done so the field name ‘Tax’ can be replaced by ‘VAT’ where appropriate.
If you do not want to use the replacement templates provided by the plugin, perhaps because you already have your own implementations, you will need to check the option to ‘use theme templates’. When this option is checked, some plugin features will no longer appear in the EDD shop. Instead you will need to further modify these templates in your theme. See the next section for more information.
The plugin implements several filters you can use to retrieve information for your theme or modify if you need to change the results of the filter.
lsl_tax_label get-country get-company get-vat-number edd_tax_rate requires-vat has-vat-number is-business-account
Each filter takes one or two parameters. Like all filters, the first parameter is mandatory and is a default value. The second is optional and is the id of the user for which the value is required. If the value is not supplied or is zero the current user will be used.
You do not need to replace the ‘get-country’, ‘get-company’, ‘get-vat-number’, ‘requires-vat’ filters to return different results. These filters will call filter of the same name but with a ‘-custom’ suffix. These filters will be called with any potential result value giving a theme filter the opportunity to override the result.
Additional filters
edd-vat-tax-rate-display preprocess-vies-company-name eddpdfi_pdf_template_extra_fields
edd-vat-tax-rate-display
It seems that everyone has an idea how the text shown alongside, say, the checkout button should appear (the button which shows the user the applicable VAT/Tax rate). Now you can devise your own display. The filter takes four arguments. The first is the default text (the text that would be shown when no filter is implemented. The second is whether or not the amount includes or is exclusive of VAT. The third is the rate based upon the country of the buyer and the fourth is the tax label (‘Tax’ or ‘VAT’). Here’s an example:
add_filter('edd-vat-tax-rate-display', 'edd_vat_tax_rate_display', 10, 4); function edd_vat_tax_rate_display($tax_rate_display, $include_tax, $tax_rate, $tax_label) { if ($tax_rate == 0) return ($include_tax ? "Including " : "Excluding ") . $tax_label; return $tax_rate_display; }
preprocess-vies-company-name
By default the plugin will only validate a VAT number if the company name entered by a buyer matches the name returned from the EC VIES site (that is, the legally registered name). Often this is not an issue but if the company name as registered with the relevant tax authority is unusual in some way then perhaps a buyer will not get it right and, so, be unable to validate their VAT number. This became apparent recently in a case involving a UK ‘sole trader’. A sole trader is an individual trading under a business name. HMRC, the UK tax authority records this as, for example, ‘Fred Bloggs trading as The Blogg Man. In VIES this appears as a ‘company name’ in the form ‘Fred Bloggs !! The Blogg Man’. Even the sole trader is unlikely to know this!
So the pre-process filter allows you to accommodate instances of unusual company names. The filter allows you to return an array of the variations of a company name returned by VIES you are prepared to accept. The following example shows how the company name for UK sole traders could be split into an array so that any one part or the whole company will be valid. In the example of our sole trader Fred Bloggs this example would cause the VAT number to be validated if the user enters either ‘Fred Bloggs’ or ‘The Blogg Man’ or ‘Fred Bloggs !! The Blogg Man’.
add_filter('preprocess-vies-company-name', 'change_vies_company_name'); function change_vies_company_name($vies_company) { // Create an array if the name contains !! $parts = explode("!!", $vies_company); // If there is more than one part, return the array if (count($parts) > 1) return $parts; // Otherwise return the whole name return $vies_company; }
eddpdfi_pdf_template_extra_fields
This filter can be used to add more information to a PDF invoice if the VAT PDF template is used. See the section on example actions can filters below.
You may be interested in the filters and actions used by the plugin if you have modified your theme or develop plugins for your site and want to be aware of any potential side effects of using this plugin.
The ‘edd_purchase_data_before_gateway’ filter is intercepted to add VAT information the purchase data passed to the selected payment gateway.
These actions are used by the plugin:
edd_purchase_form_after_user_info edd_checkout_error_checks after_insert_paymentThe ‘edd_purchase_form_after_user_info’ action is used to render the VAT and company fields. The ‘edd_checkout_error_checks’ action is used to review the VAT information when the user presses the purchase button. If necessary it will generate error messages EDD will display. The action ‘after_insert_payment’ is used to remove temporary storage of VAT information after the purchase record has been created.
When a VAT number and company name are validated, this number will be stored in the purchase information managed by EDD. When a specific purchase is reviewed later it is the number used at the time of purchase that will be shown.
However, the VAT number and company name entered will also be saved as user meta records. The company will be saved using the key ‘_vat_company’ and the number will be saved using the key ‘_vat_number’. A validated empty VAT number will delete the respected record.
Because a theme may implement its own mechanism for saving VAT information, a filter called ‘save-vat-info’ will be used so the theme can indicate that VAT info saving is not necessary. Instead an action called ‘save-vat-info’ will be called and it will pass the validated VAT number and company name.
The saved values will be returned by the get_company and get_vat_number filters if they exist.
Because the VAT number and company name are stored as user meta data they can be made available in the user profile form. To allow your users to specify or edit their VAT number you will need to add a ‘requires()’ function call to your theme’s functions.php file. The call to the requires() should reference this file from the VAT plugin’s ‘includes’ folder:
./wp-content/plugins/edd-vat/includes/user-meta.php
Useful filter and action examples
WordPress is an extensible framework and ‘actions’ and ‘filters’ are the mechanisms through which WordPress is made extensible. This mechanism can also be used to extend or change EDD and this plugin and here are three examples.
Adding more information to the PDF invoice
The templates in the PDF Invoices plugin do not allow you to add information except by editing the template file. However, the VAT PDF template includes a filter you can implement so you are able to add any information you want to the PDF invoice. Below is the filter implementation we use to add the buyer’s address.
All the cart/purchase information is available at this point via the various filter arguments. The cart’s ‘user_info’ array mentioned above appears in the ‘$eddpdfi_buyer_info’ argument. You will see that in the filter the line ‘$offset += 6;’ appears frequently. Each line in a PDF is ‘6’ units high (this is defined by the PDF Invoice plugin). The offset is incremented for each line output by the filter and the total of all lines is returned so the VAT template knows how much space the filter content requires.
You do not need to use the same function name or include the same fields but hopefully this will allow you to begin to experiment with the information you want to add.
/** * Implements filter: eddpdfi_pdf_template_extra_fields * * Adds extra information to the PDF document * * @$offset The current Y offset * @$template_name The id of this template * @eddpdfi_pdf The PDF object * @$eddpdfi_payment Payment information from the purchase * @$eddpdfi_buyer_info Buyer information from the payment info * @colors The colors to use */ function pdf_extra_include_recharge_note($offset, $template_name, $eddpdfi_pdf, $eddpdfi_payment, $eddpdfi_payment_meta, $eddpdfi_buyer_info, $colors) { if( !edd_use_taxes() ) return $offset; // If there's no VAT number there's no reverse charge (EU directive requirement regardless of local law) if (!empty($eddpdfi_buyer_info['vat_number'])) { // Only recharge if no VAT has been charged $vat = edd_get_payment_tax( $eddpdfi_payment->ID ); if ($vat == 0) { $eddpdfi_pdf->SetX( 90 ); $eddpdfi_pdf->SetTextColor( $colors['body'][0], $colors['body'][1], $colors['body'][2] ); $eddpdfi_pdf->Cell( 0, 6, 'VAT Reversed', 0, 2, 'L', false ); $offset += 6; } } // Address line 1 $eddpdfi_pdf->SetX( 60 ); $eddpdfi_pdf->SetTextColor( $colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2] ); $eddpdfi_pdf->Cell( 30, 6, __('Address', 'eddpdfi'), 0, 0, 'L', false ); $eddpdfi_pdf->SetTextColor( $colors['body'][0], $colors['body'][1], $colors['body'][2] ); $eddpdfi_pdf->Cell( 0, 6, $eddpdfi_buyer_info['address']['line1'], 0, 2, 'L', false ); $offset += 6; // Optionally add address line 2 If (!empty($eddpdfi_buyer_info['address']['line2'])) { $eddpdfi_pdf->SetTextColor( $colors['body'][0], $colors['body'][1], $colors['body'][2] ); $eddpdfi_pdf->Cell( 0, 6, $eddpdfi_buyer_info['address']['line2'], 0, 2, 'L', false ); $offset += 6; } // City If (!empty($eddpdfi_buyer_info['address']['city'])) { $eddpdfi_pdf->SetX( 90 ); $eddpdfi_pdf->SetTextColor( $colors['body'][0], $colors['body'][1], $colors['body'][2] ); $eddpdfi_pdf->Cell( 0, 6, $eddpdfi_buyer_info['address']['city'], 0, 2, 'L', false ); $offset += 6; } // State/County/Region If (!empty($eddpdfi_buyer_info['address']['state'])) { $eddpdfi_pdf->SetX( 90 ); $eddpdfi_pdf->SetTextColor( $colors['body'][0], $colors['body'][1], $colors['body'][2] ); $eddpdfi_pdf->Cell( 0, 6, $eddpdfi_buyer_info['address']['state'], 0, 2, 'L', false ); $offset += 6; } // Country $eddpdfi_pdf->SetX( 90 ); $eddpdfi_pdf->SetTextColor( $colors['body'][0], $colors['body'][1], $colors['body'][2] ); $eddpdfi_pdf->Cell( 0, 6, $eddpdfi_buyer_info['address']['country'], 0, 2, 'L', false ); // Zip $eddpdfi_pdf->SetX( 90 ); $eddpdfi_pdf->SetTextColor( $colors['body'][0], $colors['body'][1], $colors['body'][2] ); $eddpdfi_pdf->Cell( 0, 6, $eddpdfi_buyer_info['address']['zip'], 0, 2, 'L', false ); $offset += 12; // IP Address $eddpdfi_pdf->SetX( 60 ); $eddpdfi_pdf->SetTextColor( $colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2] ); $eddpdfi_pdf->Cell( 30, 6, __('IP Address', 'eddpdfi'), 0, 0, 'L', false ); $eddpdfi_pdf->SetTextColor( $colors['body'][0], $colors['body'][1], $colors['body'][2] ); $eddpdfi_pdf->Cell( 0, 6, edd_get_payment_user_ip( $eddpdfi_payment->ID ), 0, 2, 'L', false ); $offset += 6; return $offset; } add_filter('eddpdfi_pdf_template_extra_fields', 'pdf_extra_include_recharge_note', 10, 7);
Making the ‘state’ field non-mandatory
In EDD the ‘state’ field is mandatory but for most EU states this field is not relevant. However because the state/province field is used in Hungary it’s no possible to just get rid of it. Instead you can implement this filter to make it optional:
add_filter('edd_purchase_form_required_fields', 'lsl_purchase_form_required_fields'); function lsl_purchase_form_required_fields($required_fields) { // Only make the state optional when VAT applies if (!apply_filters('requires-vat', false)) return $required_fields; // If it exists, remove the requirement for the user to supply a state // Should also check to see if the country is Hungary (HR) if (isset($required_fields['card_state'])) unset($required_fields['card_state']); return $required_fields; }
This filter intercepts the ‘edd_purchase_form_required_fields’ filter which is passes an indexed array of the fields which should be considered mandatory. If VAT is required (the user is in an EU state) the entry for the state (‘card_state’) is removed from the list.
If you want to remove the state altogether, you can implement the ‘edd_after_cc_fields’ filter and replace the EDD instance to make sure the fields displayed are the ones you want. The example below how to remove the EDD implementation of this filter and replace it with your own. We do this on our site because we want the field values to be populated from a central authentication database not from the WordPress profile which we do not use. You fill the function with the same code EDD uses to generate the address field but remove the ‘state’ field. The code you need exists in the function ‘edd_default_cc_address_fields()’ which you will find in
./wp-content/plugins/easy_digital_downloads/includes/checkout/template.php
remove_action( 'edd_after_cc_fields', 'edd_default_cc_address_fields' ); add_action( 'edd_after_cc_fields’, 'lsl_default_cc_address_fields' ); function lsl_default_cc_address_fields() { // Implement your fields here. }
You can also use this idea to replace all the fields and pre-populate them with the information you want to show by default.
Capturing a company name when VAT is not collected
EDD does not provide for capturing a company name. This plugin does but only when there are three filters which co-operate to add a company name but, as you will see, only when the VAT fields would not be presented.
First of all the field has to be presented. We choose to do it response to the EDD user info filter but you can use a different EDD filter to place the field in a location of your choosing.
/** * Adds a company field to the checkout form so a user can, optionally, enter a company name */ add_action( 'edd_purchase_form_user_info', 'lsl_purchase_form_add_company' ); function lsl_purchase_form_add_company() { // Only display this field if VAT is not required. // The company name will be collected with the VAT // number if VAT is being collected. $require_vat = apply_filters('requires-vat', 0, false); $company = apply_filters('get-company', ''); $show_company = $require_vat ? "style='display:none;'" : ""; ?> <p id="non-vat-company" <?php echo $show_company; ?>> <label class="edd-label" for="edd-last"> <?php _e( 'Company', 'edd_sid' ); ?> <?php if( edd_field_is_required( 'edd_company' ) ) { ?> <span class="edd-required-indicator">*</span> <?php } ?> </label> <span class="edd-description"><?php _e( 'Enter a company name if this is a business purchase.', 'edd_sid' ); ?></span> <input class="edd-input" type="text" name="lsl-company" id="lsl-company" placeholder="<?php _e( 'Company', 'edd_sid' ); ?>" value="<?php echo is_user_logged_in() ? $company : ''; ?>"/> </p> <?php }
This one grabs any entry from the $_POST array after a user attempts to confirm their purchase and saves it into a temporary session variable:
/** * Intercept the before gateway action to grab the * $_POST instance in order to be able to grab the * additional values and save them into a session variable * @param $post * @param $user_info * @param $valid_data * @return void */ add_action( 'edd_checkout_before_gateway', 'lsl_checkout_before_gateway', 10, 3); function lsl_checkout_before_gateway($post, $user_info, $valid_data) { if (apply_filters('requires-vat', false)) return; if (!isset($post['lsl-company'])) return; // Copy the company name into the valid_data array so it can // be picked up in the edd_purchase_data_before_gateway filter $company = $post['lsl-company']; EDD()->session->set( "user_company", $company ); }
Finally if the purchase is to be processed the name is taken from the session variable and saved into the cart:
/** * Takes the company value from the session * variable and save it into the purchase data array * @param $purchase_data * @param $valid_data * @return $purchase_data */ add_filter( 'edd_purchase_data_before_gateway', 'lsl_purchase_data_before_gateway', 10, 2); function lsl_purchase_data_before_gateway($purchase_data, $valid_data) { if (apply_filters('requires-vat', false)) return $purchase_data; $company = EDD()->session->get( "user_company" ); if (!empty($company)) { EDD()->session->set( "user_company", null ); $purchase_data['user_info']['company'] = $company; } return $purchase_data; }
Changing the tax label everywhere
The VAT plugin will only change the label ‘tax’ or ‘Tax’ to ‘VAT’ in places it knows about. To change the label the plugin looks at the text emitted by WordPress plugins and changes it before it appears in the generated HTML. Because there is the potential to look at all text, this can be expense in terms of CPU time so to minimize the impact, the VAT plugin only looks at text emitted by the VAT plugin and by EDD. Even then, it is restricted to the checkout, success and purchase history pages. If you want to replace the word ‘tax’ in more places, perhaps because the word is also emitted by other of your shop plugins you can add this block of code to your theme’s functions.php file.
Again, please be aware this can be a pretty expensive filter to use.
/** * Hook the gettext filter to translate text which include the term 'Tax' on either the purchase or the checkout page */ function gst_gettext($translated, $text, $domain ) { // If translating the 'Tax' or 'VAT' string this will be true if(!preg_match("/^.*?\\btax\\b.*?$/i", $text)) return $translated; global $edd_options; $label = isset($edd_options['edd_vat_name']) ? $edd_options['edd_vat_name'] : "VAT"; $label = \lyquidity\edd_vat\initialize_actions()->tax_label('tax'); return preg_replace("/\\btax\\b/i", $label, $translated); } remove_filter( 'gettext', array( \lyquidity\edd_vat\initialize_actions(), 'edd_vat_gettext' ), 1); add_filter( 'gettext', 'gst_gettext', -1, 3);
The use of a call to the VAT plugin’s tax_label() function ensures that text is only replaced for clients from the EU. When using this function there’s no point using the function in VAT plugin so it is removed.
The function can be simplified further if this restriction is not needed – for example in GST territories:
/** * Hook the gettext filter to translate text which include the term 'Tax' on either the purchase or the checkout page */ function gst_gettext($translated, $text, $domain ) { // If translating the 'Tax' or 'VAT' string this will be true if(!preg_match("/^.*?\\btax\\b.*?$/i", $text)) return $translated; return preg_replace("/\\btax\\b/i", "GST", $translated); } remove_filter( 'gettext', array( \lyquidity\edd_vat\initialize_actions(), 'edd_vat_gettext' ), 1); add_filter( 'gettext', 'gst_gettext', -1, 3);
Starting with version 1.1.3 is it possible to completely customize the layout and presentation of the VAT fields. The template is called ‘vat-fields.php’ and can be found in the plugin’s ‘templates’ sub-folder. Template customization follows the EDD pattern: copy the vat-fields.php template file to the ‘edd_template’ sub-folder of your theme’s folder. If a folder called ‘edd_templates’ does not exist within your theme’s folder, create one.
Template parameters
The template uses property values generated by the plugin. The property values are designed to give an initial appearance, for example, should the fields be hidden and just the link shown? The properties are available in a global variable called ‘$vat_fields’. There are 12 properties:
Name | Description |
---|---|
company | The company name if one already exists |
vat_number | The VAT number if one already exists |
valid | A ‘true’ value if the VAT number exists and has been validated |
requires_vat | A ‘true’ value if VAT applies to currently selected country |
ignore_style | The style to control whether the VAT fields should not be shown or not (requires_vat is ‘false’) |
link_style | The style applied to the link to control whether the link is visible or not. |
fields_style | Controls whether the VAT field will be shown. It represents the opposite styling to ‘link_style’. |
not_given_text_css | A style to control the visibility of the text which tells the user no number has been given. |
not_validated_text_css | A style to control the visibility of the text which tells the user the VAT number is not valid. |
reset_button_css | A style to control the visibility of the Reset button. |
validate_button_css | A style to control the visibility of the Validate button. |
validated_text_css | A style to control the visibility of the text which tells the user the VAT number is valid. |
Because the correct function of the plugin UI is dependent upon the values of these properties it is recommended that you augment them rather than change them.
The term ‘Tax’ is hardcoded into the EDD checkout and receipt templates. In order to present an alternative tax name, it has been necessary to replace the two EDD templates ‘shortcode-receipt’ and ‘checkout_cart’ so the correct taxation name is presented to a site visitor. Hopefully this does not matter to your site. However, if your site has already modified these templates then the plugin will, by default, present its own copies of these template causing a visual experience you do not expect or want.
In this case, you will need to use the plugin’s setting on the ‘Taxes’ settings page to disable this behavior. You will then need to include the modifications we have made to these template in your own copies. You will be able to see the changes required by comparing our copies of these templates with the EDD originals. Our copies of these templates are in a sub-folder called ‘templates’.
If you have installed the EDD PDF Invoice plugin you can choose to use the VAT PDF template. The template appears as an option in the template selection list which is available the PDF Invoice plugin settings. The VAT PDF template is based on the ‘Colors’ Invoice template. This plugin allows you to select color of the VAT template.
This plugin adds three new filters to be used in a purchase confirmation email. They are:
The plugin also allows you to create your purchase confirmation in a different way. The information needed in the email already exists in the purchase confirmation page. This page is generated by the ‘shortcode-receipt’ template so this plugin allows the email to be generated from the template.
To use this alternative means to generate an email enable this plugin’s option ‘Enable sending the receipt as an email’. Then use a new shortcode:
<h2>Thank you for your purchase</h2>
We're here to help you every step of the way. Contact Us by sending a private message or ask a question in the support forums.
We're always looking for ways to improve what we offer and so help you do business. Need something, not exactly what you are looking for … let us know, we might be able to help.
Used by a growing number of websites throughout the world - we help smooth your WordPress site use.
Comments
3 Comments on “VAT for Easy Digital Downloads”