=== Brasa Checkout Brasil for WooCommerce ===
Contributors: designmasterbr
Tags: cpf, cnpj, brazil, checkout, woocommerce
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds a single CPF or CNPJ field (including the new alphanumeric CNPJ), number and neighborhood to the WooCommerce block and classic checkout.

== Description ==

Brazilian stores must collect the buyer's CPF (individuals) or CNPJ (companies) to issue invoices. This plugin adds one "CPF ou CNPJ" field to the checkout and validates it on the server.

* Works in the block checkout (Additional Checkout Fields API) and in the classic shortcode checkout.
* Accepts the alphanumeric CNPJ issued by the Brazilian Federal Revenue since July 2026 (for example 12.ABC.345/01DE-35).
* Detects CPF or CNPJ by length, so the buyer does not need to pick a person type.
* Saves the document on the order in the same meta keys used by the Brazilian Market plugin (`_billing_cpf`, `_billing_cnpj`, `_billing_persontype`), so invoice and shipping plugins keep reading it.
* Adds the Number and Neighborhood address fields to both checkouts, saved as `_billing_number`, `_billing_neighborhood` (and the shipping ones), the keys Brazilian Market uses.
* Returning customers find the field already filled with the CPF or CNPJ, number and neighborhood saved by Brazilian Market, in both checkouts.
* Compatible with High-Performance Order Storage (HPOS).

The plugin stores the document only on the order and customer records of your own store. It sends no data to external services.

== Installation ==

1. Install and activate WooCommerce.
2. Upload the plugin folder to `/wp-content/plugins/` or install it from the Plugins screen, then activate it.
3. The field appears in the checkout right away. No configuration is needed.

== Frequently Asked Questions ==

= Does it validate the new alphanumeric CNPJ? =

Yes. Letters are accepted in the first 12 positions and the check digits are calculated with the official rule.

= Can I use it together with Brazilian Market on WooCommerce? =

This plugin replaces its CPF/CNPJ, number and neighborhood fields, so deactivate Brazilian Market to avoid asking twice. Orders and customers keep the same meta keys, so old orders still show the document and the address.

== Changelog ==

= 0.2.0 =
* Number and Neighborhood fields in the block and classic checkout, mirrored to the Brazilian Market keys and prefilled for returning customers.

= 0.1.0 =
* First version: CPF/CNPJ field with input mask in the block and classic checkout, server-side validation, and the document on the admin order screen and order e-mails; prefills the document saved by Brazilian Market for returning customers.
