=== Brazilian Checkout Toolkit for WooCommerce ===
Contributors: riaanknoetze
Tags: woocommerce, checkout, brazil, cpf, cpnj
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Brazil-ready checkout for WooCommerce: CPF/CNPJ fields, validation, masks, and full Checkout Block compatibility.

== Description ==

Brazilian stores need a few extra checkout fields to be compliant, avoid delivery issues, and reduce payment gateway errors.

**Brazilian Checkout Toolkit for WooCommerce** adds Brazilian-specific checkout fields (CPF/CNPJ, person type, neighborhood, street number, etc.), improves the customer experience with input masks, and works with both:

* **Classic (shortcode) WooCommerce checkout**
* **WooCommerce Checkout Block** (Cart & Checkout Blocks)

It also mirrors field values into the legacy `_billing_*` meta keys used by many themes, integrations and gateways.

= Mission =
Make the WooCommerce checkout truly Brazil-friendly — with the right fields, the right validation, and a smooth UX.

= Why this plugin =
Unlike older solutions that only work on the classic checkout, this plugin is built for modern WooCommerce stores:

* **Checkout Block compatible** (WooCommerce 9.0+ Additional Checkout Fields API)
* **Backwards compatible** with classic checkout and existing integrations
* **Lightweight, settings-driven** (enable only what your store needs)

= Key features =

* **Person type** (Individual / Company)
* **CPF / CNPJ** fields with optional validation (settings)
* Optional fields (settings): **RG**, **State Registration (IE)**, **Birthdate**, **Gender**
* **Street number** and **Neighborhood** fields (Neighborhood can be optional/required)
* **Cell phone options** (optional field, required field, or replace WooCommerce phone)
* **Input masks / formatting** for CPF, CNPJ, phone and more (settings)
* **Email typo suggestion** (Mailcheck) to help reduce checkout failures
* **Brazilian address formatting** in orders and “My account” addresses
* **REST API enhancements**: exposes the extra fields on WooCommerce REST responses
* **HPOS compatible** (WooCommerce High-Performance Order Storage)

= Where to find the settings =
WooCommerce → Settings → Shipping → **Brazilian Checkout Fields**

= Compatibility & requirements =

* Requires **WooCommerce**
* WordPress 6.0+ (tested up to 7.0)
* PHP 7.4+
* WooCommerce **9.0+** recommended for Checkout Block support (the plugin auto-detects the Blocks API)

= Integrations =

This plugin includes compatibility layers / data mapping for:

* **Flux Checkout for WooCommerce**
* **Bcash** (adds number and CPF/CNPJ data)
* **Moip / Moip Transparent Checkout** (adds number, neighborhood, CPF and birthdate when available)

= Credits =

This plugin is based on the original Brazilian checkout fields work by **Claudio Sanches** and contributors, and has been significantly refactored/modernized.

Third-party libraries included:
* Mailcheck jQuery (https://github.com/Kicksend/mailcheck)
* jQuery Mask Plugin (https://github.com/igorescobar/jQuery-Mask-Plugin)

== Installation ==

1. Install and activate **WooCommerce**.
2. Upload this plugin to `/wp-content/plugins/` or install it via the Plugins screen.
3. Activate **Brazilian Checkout Toolkit for WooCommerce**.
4. Go to WooCommerce → Settings → Shipping → **Brazilian Checkout Fields** and configure the fields.

== Frequently Asked Questions ==

= Does it work with the WooCommerce Checkout Block? =

Yes. If your WooCommerce version provides the **Additional Checkout Fields** API (WooCommerce 9.0+), the plugin registers the Brazilian fields for the Checkout Block automatically.

= Does it still work with the classic checkout? =

Yes. The plugin keeps the classic checkout field injection and validation, and also avoids rendering duplicate fields when the Checkout Block is used.

= Can I make CPF/CNPJ validation optional? =

Yes. Validation can be enabled/disabled in the plugin settings.

= Can I show only Individuals or only Companies? =

Yes. You can configure “Person type” mode in the settings.

= Where is the settings page? =

WooCommerce → Settings → Shipping → **Brazilian Checkout Fields**.

== Screenshots ==

1. Settings screen (WooCommerce → Settings → Shipping → Brazilian Checkout Fields)
2. Checkout Block with Brazilian fields (CPF/CNPJ, person type, number, neighborhood)
3. Classic checkout with Brazilian fields and input masks
4. Order admin screen showing saved Brazilian customer data
5. My Account → Addresses showing the Brazilian address format

== Changelog ==

= 1.2.0 =
* Update - Tested up to WordPress 7.0.
* Update - Declared compatibility up to WooCommerce 10.9.
* Dev - Added local test suite (PHPUnit unit + integration, Playwright e2e) and PHPCS WordPress/WooCommerce coding standards configuration.

= 1.1.0 =
* New - WooCommerce compatibility

= 1.0.0 =
* Initial release.
