Download the PHP package gewebe/sylius-vat-plugin without Composer
On this page you can find all versions of the php package gewebe/sylius-vat-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gewebe/sylius-vat-plugin
More information about gewebe/sylius-vat-plugin
Files in gewebe/sylius-vat-plugin
Package sylius-vat-plugin
Short Description VAT number address field with validation, EU VAT rates plugin for Sylius
License MIT
Informations about the package sylius-vat-plugin
Sylius VAT number and rates plugin
Features
- Installer for EU VAT rates with countries and zones
- New fields for VAT number at
AddressandShopBillingDataentity - Configure VAT number field requirement:
- Optional / Required
- Required if customer filled “Company” field
- Required in selected countries
- Validate VAT number:
- Revalidate customers VAT numbers after a given time
- Optionally show the VAT number validation status in the customer address book, checkout summary and order history
- Placing an order without VAT in the EU, if
- VAT number validation was successful
- Customers taxation country is different from shop billing country
Installation
Download the plugin via composer
Enable the plugin in bundles.php
Import the plugin configurations
Configure taxation address
For EU VAT, the address for taxation should be set to the shipping address in the Sylius configuration.
Extend Address entity
If you use yaml mapping add also:
Add or Extend ShopBillingData entity
If you use yaml mapping add also:
Override the resource for shop_billing_data in your sylius config:
Update your database schema
Usage
Install EU countries and VAT rates
Validate customers VAT number
1. Create new order with VAT number at shipping address
2. Show VAT number and validation status at admin orders
Show the validation status in the customer account and checkout
The address book and the address cards in the checkout summary and customer order history can display whether a VAT
number is valid, invalid, or not yet validated. The address book and checkout summary also show whether a validation
has expired according to revalidate.expiration_days, while the order history preserves the status at the time the
order was placed.
The display is disabled by default and can be enabled with:
VAT number normalization
VAT numbers are converted to uppercase and whitespace, dots and hyphens are removed before they are
stored or validated. For example, de 123.456-789 is stored as DE123456789.
Special EU VAT prefixes
Greek VAT numbers use the EL prefix even though the address country code is GR. The plugin
accepts this mapping for country and VIES registration validation.
Northern Ireland VAT numbers use the XI prefix (for example XI123456789). For an address in the
United Kingdom (GB), these numbers are validated through VIES and are treated as EU VAT numbers
when determining whether VAT can be removed from a cross-border order.
Validate UK VAT numbers with the HMRC API
VAT numbers of addresses in the United Kingdom (country code GB) are validated against the
HMRC "Check a UK VAT number" API
Version 2 of the API.
Configure the credentials and, optionally, the API base URL in the application config:
Accepted UK VAT number formats are standard (GB123456789), branch traders (GB123456789001), government
departments (GBGD001) and health authorities (GBHA599); the GB prefix is optional.
Government department and health authority numbers cannot be looked up online and are therefore
only checked for their format.
Testing
Traditional
- From the plugin skeleton root directory, run the following commands:
To be able to set up a plugin's database, remember to configure your database credentials in tests/TestApplication/.env and tests/TestApplication/.env.test.
-
Run your local server:
- Open your browser and navigate to
https://localhost:8000.
Docker
-
Execute
make initto initialize the container and install the dependencies. -
Execute
make database-initto create the database and run migrations. -
(Optional) Execute
make load-fixturesto load the fixtures. - Your app is available at
http://localhost.
Usage
Running plugin tests
-
PHPUnit
-
Behat (non-JS scenarios)
-
PHPStan - Static Analysis
- Coding Standard
All versions of sylius-vat-plugin with dependencies
ibericode/vat Version ^2.1
sylius/sylius Version ^2.1
symfony/http-client Version ^6.4 || ^7.4