=== STM EU-B2B ===
Contributors: jobhunter99
Tags: b2b, wholesale, vat, reverse charge, customer groups
Requires at least: 6.7
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.9.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

B2B and Wholesale for WooCommerce in Europe: business customers, group prices, VAT ID check with VIES and a reverse charge decision you can follow.

== Description ==

STM EU-B2B turns a WooCommerce shop into a shop for business customers – or for business customers and consumers side by side – with the rules European shops need. A valid VAT ID alone never exempts an order: EU-B2B decides with a table you can read, and writes the reason into every order.

https://www.youtube.com/watch?v=LdPdahI79pU

The film shows every feature in the demo shop with sample data: the free plugin first, STM EU-B2B Pro from 5:18. The contents with direct links are at the end of this description.

= What sets it apart =

* **Built for VAT in Europe.** VAT ID check with VIES, a tax decision per order with its reason, country profiles with source and review status. Unclear cases are taxed and flagged, never exempted silently.
* **Business customers and consumers in one shop.** Customer types, groups, group prices, net prices for businesses and gross prices for consumers.
* **Privacy by design.** Export, erasure, retention periods and a record of processing activities for everything EU-B2B stores. No telemetry, no tracking.
* **Works with what you have.** HPOS, the classic checkout and the Cart and Checkout blocks; tested next to Germanized.

= All free features =

**Customers and groups**

* Every customer is a business or a consumer and belongs to a customer group. You create the groups yourself, for consumers too.
* The user profile shows type, group and status, and the user list filters by them.
* Based on revenue, EU-B2B suggests group changes. Nobody moves on their own: you decide with one click.

**Registration and approval**

* Registration types such as wholesale or consumer. Each type is approved automatically or after your review, and lands in a fixed group.
* Custom fields ask for what you need, and later appear in the order.
* Customers upload documents as files. They are stored privately and deleted 30 days after your decision.
* A hidden field and a limit per address keep spam out.
* You review new applications in a list: approve into a group, or decline with a reason. The customer gets an e-mail either way.
* Until approval, the customer cannot log in, and sees why.
* A registration form block for the block editor.

**Prices and discounts**

* Each group has its own regular and sale price, for simple products and every variation.
* The group price applies in the shop, the cart, the mini cart and the order.
* Percentage discounts apply to an audience, to products or categories, and only for a period if you like.
* You decide whether several discounts add up or only the most important one applies.
* At checkout, the server recalculates every price; nothing is taken over from the cart.

**Payment and shipping**

* You decide which payment methods a group sees, for guests and single customers too.
* The same goes for shipping methods per shipping zone.

**VAT ID**

* VAT ID field at registration, in My Account, in the classic checkout and in the Checkout block.
* Format and length are checked at once, for every EU country, Northern Ireland, Switzerland, Liechtenstein and Norway.
* Check with VIES, the EU's validation service (off until you switch it on). EU-B2B stores the time, the result, the consultation number and the name returned as evidence.
* If VIES is down, EU-B2B tries again and puts the number up for review.
* Older results are checked again after a period you set.

**Tax decision per order**

* A decision table you can read: domestic sales, intra-Community supplies and services with reverse charge, exports to third countries, Switzerland and Liechtenstein.
* An order is exempt only when every condition is met. A VAT ID from the shop's own country never exempts.
* The exemption applies in the cart already, and the reason is in the order and in the e-mail.
* Whether a product is goods or a service is set on the product.
* Pick-up at the shop is taxed and flagged for review.
* Business customers see net prices, consumers gross prices, each with its own price suffix.
* Every country has a profile with its source and review status; nothing unreviewed is ever exempted automatically.
* Unclear cases are taxed and flagged for review, and you confirm the review on the order.

**Legal texts and privacy**

* Business customers get their own terms, and the order records which ones.
* If you like, the withdrawal button is hidden for business orders.
* Personal data export and erasure for everything EU-B2B stores, in the WordPress privacy tools.
* What is no longer needed is deleted after periods you set.
* Site Health reports what is still missing for privacy.
* A suggested text for your privacy policy and a record of processing activities (Art. 30 GDPR), generated from the features you use.
* An audit log records who in your team decided what, for one year.
* No telemetry, no tracking, no remote fonts. The only external connection is the VAT ID check (see External services).

**Administration**

* An overview shows what is waiting for you: registrations to approve, VAT ID checks to look at, orders to review.
* You export all settings as a file and import them into another shop, with a preview.
* A product data tab of its own and coloured statuses.

**Switching from another B2B plugin**

* Moving from B2BKing or Wholesale Suite: customer groups, business customers and group prices come along, with a test run first.
* Every import has a log and can be undone.

= Languages =

The plugin is written in English and gets its translations from translate.wordpress.org. Complete translations into German (informal and formal), French, Italian, Spanish, Dutch and Polish exist and are submitted there; until they are approved there, the plugin shows English. The French, Italian, Spanish, Dutch and Polish translations were made with machine assistance and a fixed glossary; corrections are welcome.

= STM EU-B2B Pro =

The free plugin is complete in itself and stays that way. STM EU-B2B Pro is a separate, paid add-on for shops that need more:

* **Guest access and closed shop:** guests see no prices, no shop, or only the login; public pages such as the legal notice and the privacy policy stay open. If you like, the shop is open to business customers only.
* **Visibility per group:** categories, products and single variations for certain groups only. What is hidden does not show up in search, sitemap or API either. Any block on a page can be visible to one audience only.
* **Customer prices, tiers and price lists:** own prices for single customers, tier prices per group with a table that follows the quantity, the recommended retail price next to the trade price, and price lists you export, edit in a spreadsheet and import again.
* **Pricing rules:** conditions on cart value, quantity, country, payment or shipping method; fixed prices, markups, fees, free shipping or a hidden price; a discount as a line of its own in the cart.
* **Coupons and currencies:** coupons for certain groups only, or not at all for businesses; a currency per group with its own prices, with support for the FOX currency switcher.
* **Quantities and order value:** minimum and maximum quantities and pack sizes per product, group and variation; a minimum order value, with the missing amount named in the cart.
* **Order form:** search by name or SKU with stock, unit price and total; rows pasted from Excel or a CSV file; a report of what went into the cart and what did not.
* **Purchase lists and variation table:** saved carts the whole company can use, and several variations ordered from one table.
* **Stock for business customers:** separate stock with its own backorders, or orders that never reduce the stock; the exact quantity for business customers only.
* **Quote requests and offers:** requests from the cart or the product page, also for guests if you like; offers with products or free lines and an expiry date, as a PDF, accepted in My Account at the quoted prices; messages with a counter for unread ones.
* **Company accounts:** several buyers invited by e-mail, role templates for buying, viewing, approving and managing, every order with the person who placed it, and a logged login as a member for support.
* **Order approval:** above a set amount the order waits for approval within the company; the approvers get an e-mail and approve or decline.
* **Pay by invoice and purchase order:** with PO number and PO document, pay by invoice from an order value, payment terms per group with the due date in the order, limits, discounts or surcharges per payment method, shipping costs per group.
* **Overdue invoices and reminders:** late payment interest and the 40 euro flat fee; reminders in three levels, sent by you after a preview.
* **Checks with national registers:** the German Federal Central Tax Office (BZSt) with name and address, the Swiss UID register and the Norwegian Brønnøysund register; Northern Ireland and special territories such as the Canary Islands by their own rules.
* **Tax evidence:** the file for the EC Sales List, proof of intra-Community supply with the customer's confirmation, export evidence with its reference number, an audit file per order as a PDF and the OSS threshold monitor.
* **Accounting and reports:** a booking batch in the DATEV format; revenue per month, customer type, group and company, every table as CSV.
* **E-invoicing data and REST API:** buyer reference, Leitweg-ID and Peppol ID, passed to Germanized Pro and PDF Invoices & Packing Slips; a REST API for groups, customers, rules and prices.

Pro requires this free plugin in the same version: [STM EU-B2B Pro for WooCommerce](https://en.storetown-media.de/produkt/eurob2b-pro-woocommerce/). This plugin has a page of its own as well: [STM EU-B2B for WooCommerce](https://en.storetown-media.de/produkt/eurob2b-woocommerce/).

STM EU-B2B gives no tax or legal advice. It shows what it decides, and why; your tax adviser decides how your shop is set up.

= Contents of the film =

**The free plugin**

* [0:00 Key features at a glance](https://www.youtube.com/watch?v=LdPdahI79pU&t=0s)
* [0:46 Customer types and groups](https://www.youtube.com/watch?v=LdPdahI79pU&t=46s)
* [1:00 Group changes based on revenue](https://www.youtube.com/watch?v=LdPdahI79pU&t=60s)
* [1:12 Registration with custom fields](https://www.youtube.com/watch?v=LdPdahI79pU&t=72s)
* [1:39 Approving new customers](https://www.youtube.com/watch?v=LdPdahI79pU&t=99s)
* [1:51 Group prices](https://www.youtube.com/watch?v=LdPdahI79pU&t=111s)
* [2:02 Discounts per group and category](https://www.youtube.com/watch?v=LdPdahI79pU&t=122s)
* [2:22 Payment and shipping per group](https://www.youtube.com/watch?v=LdPdahI79pU&t=142s)
* [2:33 VAT ID at checkout](https://www.youtube.com/watch?v=LdPdahI79pU&t=153s)
* [2:49 VIES check](https://www.youtube.com/watch?v=LdPdahI79pU&t=169s)
* [3:13 Tax decision per order](https://www.youtube.com/watch?v=LdPdahI79pU&t=193s)
* [3:44 Net, gross and country profiles](https://www.youtube.com/watch?v=LdPdahI79pU&t=224s)
* [4:05 B2B terms, withdrawal and data requests](https://www.youtube.com/watch?v=LdPdahI79pU&t=245s)
* [4:20 Privacy: deletion periods and processing record](https://www.youtube.com/watch?v=LdPdahI79pU&t=260s)
* [4:42 Overview, export and import](https://www.youtube.com/watch?v=LdPdahI79pU&t=282s)
* [4:52 Moving from B2BKing and Wholesale Suite](https://www.youtube.com/watch?v=LdPdahI79pU&t=292s)

**STM EU-B2B Pro**

* [5:18 Guest access and closed shop](https://www.youtube.com/watch?v=LdPdahI79pU&t=318s)
* [5:31 Visibility per group](https://www.youtube.com/watch?v=LdPdahI79pU&t=331s)
* [5:47 Customer prices, tiers and price lists](https://www.youtube.com/watch?v=LdPdahI79pU&t=347s)
* [6:09 Pricing rules](https://www.youtube.com/watch?v=LdPdahI79pU&t=369s)
* [6:26 Coupons and currencies](https://www.youtube.com/watch?v=LdPdahI79pU&t=386s)
* [6:39 Minimum quantities and order value](https://www.youtube.com/watch?v=LdPdahI79pU&t=399s)
* [6:49 Order form with Excel and CSV](https://www.youtube.com/watch?v=LdPdahI79pU&t=409s)
* [7:06 Purchase lists and variation table](https://www.youtube.com/watch?v=LdPdahI79pU&t=426s)
* [7:16 Stock for business customers](https://www.youtube.com/watch?v=LdPdahI79pU&t=436s)
* [7:31 Quote requests](https://www.youtube.com/watch?v=LdPdahI79pU&t=451s)
* [7:46 Quotes with PDF](https://www.youtube.com/watch?v=LdPdahI79pU&t=466s)
* [8:04 Company accounts and roles](https://www.youtube.com/watch?v=LdPdahI79pU&t=484s)
* [8:22 Order approval](https://www.youtube.com/watch?v=LdPdahI79pU&t=502s)
* [8:32 Pay by invoice and payment terms](https://www.youtube.com/watch?v=LdPdahI79pU&t=512s)
* [8:55 Late interest and reminders](https://www.youtube.com/watch?v=LdPdahI79pU&t=535s)
* [9:08 Checks with BZSt, UID register and Brønnøysund](https://www.youtube.com/watch?v=LdPdahI79pU&t=548s)
* [9:27 EC Sales List, proof of supply and export](https://www.youtube.com/watch?v=LdPdahI79pU&t=567s)
* [9:42 Audit file and OSS threshold](https://www.youtube.com/watch?v=LdPdahI79pU&t=582s)
* [9:52 DATEV export and reports](https://www.youtube.com/watch?v=LdPdahI79pU&t=592s)
* [10:04 E-invoicing data and REST API](https://www.youtube.com/watch?v=LdPdahI79pU&t=604s)

**Closing**

* [10:23 What it does not replace, free and Pro](https://www.youtube.com/watch?v=LdPdahI79pU&t=623s)

== Installation ==

1. Install and activate WooCommerce (10.0 or newer).
2. Install EU-B2B from *Plugins → Add New* or upload the zip file, then activate it.
3. Open *STM EU-B2B → Settings*: set your shop's VAT ID, choose how the VAT ID field behaves and whether VAT IDs are checked with VIES.
4. Create customer groups under *STM EU-B2B → Customers → Groups* and assign business customers to them.

EU-B2B needs PHP 8.1 or newer.

== Frequently Asked Questions ==

= Does a valid VAT ID make an order tax-free? =

Not on its own. EU-B2B exempts an order only when every condition of the decision table holds: business customer, VAT ID of another member state confirmed as valid, place of supply in another member state, no self-collection, the exemption switched on and the country rules reviewed. Everything else is taxed, and unclear cases are flagged for review.

= Is this tax or legal advice? =

No. EU-B2B documents the rules it applies with their sources, but your tax adviser decides how your shop is set up.

= Does EU-B2B work with the Cart and Checkout blocks? =

Yes. The VAT ID field, the tax decision and the price display work in the classic checkout and in the Cart and Checkout blocks. Differences that remain are listed on the settings page.

= Does EU-B2B work with Germanized or German Market? =

EU-B2B is tested next to Germanized and leaves legal texts, invoices and the withdrawal button to the plugins that provide them.

= Where are the data stored? =

In your WordPress database only. Nothing is sent to Storetown Media.

== External services ==

EU-B2B connects to one external service, and only when you use it:

* **VIES (VAT Information Exchange System) of the European Commission** checks whether a VAT ID is valid. The check is off until you switch it on in the settings (*Validate EU VAT IDs via VIES*). Then, when a customer enters a VAT ID or shop staff check one again, EU-B2B sends the VAT ID and, if you entered it in the settings, your shop's own VAT ID (so that VIES returns a consultation number). No trader name or address and no other personal data is sent. Requests go to `https://ec.europa.eu/taxation_customs/vies/rest-api/check-vat-number` and, when that does not answer, to `https://ec.europa.eu/taxation_customs/vies/services/checkVatService` (the SOAP interface of the same service). Service: https://ec.europa.eu/taxation_customs/vies/ – terms of use (legal notice of the European Commission): https://commission.europa.eu/legal-notice_en – privacy policy: https://commission.europa.eu/privacy-policy-websites-managed-european-commission_en

Besides that, the Site Health test *Uploaded documents are not reachable from the web* requests a small test file from your own site to check that uploaded documents are protected. This request goes to your own site only and sends no data.

== Screenshots ==

1. Group prices per customer group on the product (tab STM EU-B2B).
2. Registration approvals: approve a business customer into a group, or reject with a note.
3. VAT ID validations with VIES, the stored evidence and the cases that need a look.
4. The order shows customer type, group, VAT ID check and the tax treatment with its reason.
5. Settings for tax and VAT IDs, including the VIES check and the countries checked at checkout.

== Changelog ==

The full changelog is in CHANGELOG.md in the plugin folder and on https://github.com/storetown-media/stm-eurob2b.

= 1.9.2 =
* The list of VAT ID checks that need a look works on SQLite (for example WordPress Playground).

= 1.9.1 =
* All output is escaped where it is printed; the printable record of processing activities and the confirmation prompts no longer use inline style or script tags.
* The privacy notice on the export and erase screens shows its list with bullets again.

= 1.9.0 =
* Translations now come from translate.wordpress.org; the plugin no longer ships its own language files.
* STM EU-B2B Pro has its own text domain and keeps the translations of both plugins until language packs exist.
* Plain-text e-mails, the registration form and the admin styles follow the WordPress.org guidelines more closely.
* The external services section of this readme names the VIES endpoints and the Site Health self-test.

= 1.8.1 =
* The settings screens are translated again (1.8.0 showed them in English on sites in other languages).
* The plugin links point to the public repository on GitHub.

= 1.8.0 =
* EuroB2B is now STM EU-B2B. The plugin moves to the folder stm-eu-b2b; all settings and data stay. See the upgrade notice.
* Ready for the WordPress.org plugin directory: messages escaped, uploads through WordPress, translations loaded on time.
* Order screen: the internal supply type field is no longer listed under the order lines.

= 1.7.0 =
* Checkout block: the result of the VAT ID check appears at the billing address as soon as the number changes.

= 1.6.0 =
* Confirm the review of orders whose tax treatment EU-B2B could not decide itself; the overview lists them.
* Contact details, data protection officer and representative for the record of processing activities in the privacy settings.
* Summaries in the EU-B2B product tab.

= 1.5.0 =
* Clearer admin: the EU-B2B menu is grouped into areas with an overview of what is waiting, settings with a side navigation, coloured statuses and a product data tab of its own.
* My Account tables fit narrow theme columns.

= 1.4.0 =
* First release on WordPress.org: EU-B2B is now the free core; the Pro features moved to the separate add-on EU-B2B Pro.

== Upgrade Notice ==

= 1.9.2 =
If you use STM EU-B2B Pro, update it to 1.9.2 at the same time; until both have the same version the Pro features are off.

= 1.9.1 =
If you use STM EU-B2B Pro, update it to 1.9.1 at the same time; until both have the same version the Pro features are off.

= 1.9.0 =
If you use STM EU-B2B Pro, update it to 1.9.0 at the same time; until both have the same version the Pro features are off. Without Pro, EU-B2B shows English until its language pack from translate.wordpress.org is available.

= 1.8.0 =
EuroB2B is now STM EU-B2B. Install STM EU-B2B and update STM EU-B2B Pro first, then deactivate the old "EuroB2B": STM EU-B2B takes over with all data. Then delete the old plugin.

= 1.4.0 =
EU-B2B is now split into the free core and the add-on EU-B2B Pro. If you used Pro features (quotes, company accounts, order form, tier prices, invoice payment, tax reports …), install EU-B2B Pro so they stay available.
