sehrgut / wp-eu-vat-helpers
WordPress helper shortcodes to display prices including applicable VAT rate for the user's location (based on IP address)
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:wordpress-plugin
Requires
- mpociot/vat-calculator: ~2.2.0
Requires (Dev)
- mockery/mockery: ^0.9.9
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2023-03-14 01:56:49 UTC
README
WordPress helper shortcodes to display prices including applicable VAT rate for the user's location (based on IP address)
This WordPress plugin is basically a wrapper around the nifty mpociot/vat-calculator library. Use at your own risk for the following:
- Format number as localized currency, adding VAT according to the rate of the visitor's country
- Display tax rate of the visitor's coutry
- Display the visitor's country
- Conditionally show/hide elements based on whether EU VAT is applicable in the visitor's country
Installation
- Recommended (most frequent updates):
composer require sehrgut/wp-eu-vat-helpers
- Alternative (possibly outdated): Via WordPress plugin directory or zip download, you know that stuff for sure…
Available Shortcodes
[localize_currency]
[vat_rate]
[ip_country]
[if_taxable] … [/if_taxable]
[unless_taxable] … [/unless_taxable]
Shortcode Usage
[localize_currency]
Add EU VAT to value and format the result as currency.
Example:
[localize_currency value="133.42" currency="EUR"]
Attributes:
Attribute | Required | Default | Effect |
---|---|---|---|
value |
required | – | The amount to format |
currency |
optional | 'EUR' | Currency as three-letter ISO-4217 code |
country |
optional | based on user's IP address | Override the country for which to apply taxes and adapt the format (two-letter ISO-3166-1 alpha-2 code) |
[vat_rate]
Display the EU VAT rate applicabe in the current user's country in percent.
Example:
[vat_rate]
Attributes:
Attribute | Required | Default | Effect |
---|---|---|---|
country |
optional | based on user's IP address | Override the country whose VAT rate to display (two-letter ISO-3166-1 alpha-2 code) |
[ip_country]
Display the current user's country based on their IP address.
Example:
[ip_country]
Attributes: none
[if_taxable]
Condtitionally display a piece of content if EU VAT is applicable in the current user's country.
Example:
[if_taxable]Echo something[/if_taxable]
Attributes:
Attribute | Required | Default | Effect |
---|---|---|---|
country |
optional | based on user's IP address | Override the country for which to check (two-letter ISO-3166-1 alpha-2 code) |
[unless_taxable]
Condtitionally display a piece of content if EU VAT is not applicable in the current user's country. (Inverse of
if_taxable
)
Example:
[unless_taxable]Echo something[/unless_taxable]
Attributes:
Attribute | Required | Default | Effect |
---|---|---|---|
country |
optional | based on user's IP address | Override the country for which to check (two-letter ISO-3166-1 alpha-2 code) |
Devlopment / Testing
# Install git clone git@github.com/sehrgutesoftware/wp-eu-vat-helpers.git cd wp-eu-vat-helpers composer install # Test composer unit composer integration
Support
Please use Github Issues for Questions, Bug reports, Feature suggestions and everything else.
Compatibility
This plugin was tested with WordPress 4.8.x and PHP 7.1 & 7.2
License
Copyright 2017 Sehr gute GmbH – licensed under the MIT License.