Polmichael Recargo de Equivalencia y NIF/CIF for WooCommerce

By polmichael

0+ active installationsVersion 1.0.0

Spain B2B tax plugin for WooCommerce: apply Recargo de Equivalencia by role and validate Spanish NIF, NIE & CIF tax IDs. HPOS ready.

Description

Polmichael Recargo de Equivalencia y NIF/CIF for WooCommerce provides clean, lightweight, and 100% HPOS (custom_order_tables) and Checkout Blocks (cart_checkout_blocks) compatible Spanish B2B tax management for WooCommerce stores selling in Spain.

Designed specifically for Spanish wholesale and B2B/B2C hybrid stores, it automates the mandatory Recargo de Equivalencia VAT surcharge for retail merchants (comerciantes minoristas autónomos) and adds official algorithmic verification for Spanish tax identification numbers (NIF, DNI, NIE, and CIF).

Key Free Features

  • Dedicated “Minorista con Recargo de Equivalencia” Role: Automatically registers the rfes_minorista_re customer role and allows assigning Recargo de Equivalencia to any WordPress role or individual customer profile.
  • Exact Post-Coupon Net Base Calculation: Calculates the Spanish Recargo de Equivalencia (+5.2% on the general 21% IVA rate) strictly on the post-discount net taxable base without distorting product base prices on stores configured with “Prices entered with tax”.
  • Automatic Spanish Geographic Tax Filter: Ensures Recargo de Equivalencia is only applied when the customer’s tax address is in Spain (ES — Peninsula and Balearic Islands), automatically excluding the Canary Islands (TF, GC), Ceuta (CE), and Melilla (ML) where IGIC/IPSI apply.
  • Official Algorithmic NIF, DNI, NIE & CIF Validation (Orden EHA/451/2008):
    • Validates Modulo 23 check letters for Spanish DNI / NIF and NIE (X, Y, Z), special personal NIFs (K, L, M), and even/odd checksum digits and letters for corporate CIF numbers (A-H, J, N, P-S, U, V, W).
    • Article 149 Spanish VAT Law (LIVA) Protection: Prevents applying Recargo de Equivalencia when a customer enters a corporate entity CIF (Sociedad Limitada S.L. or Sociedad Anónima S.A.), reserving the regime for individual retail merchants (autónomos) and Comunidades de Bienes (E, J).
  • Native Support for Both Checkout Blocks & Classic Checkout: Uses WooCommerce’s native Additional Checkout Fields API (woocommerce_register_additional_checkout_field) on Checkout Blocks and standard billing fields on Classic Checkout.
  • 100% Native WooCommerce HPOS Storage: Persists _rfes_tax_id, _rfes_fiscal_regime, and _rfes_breakdown exclusively through the WC_Order CRUD API ($order->update_meta_data() and $order->get_meta()).

Optional Pro Add-on Features

For stores and agencies needing live customer self-selection at checkout, multi-rate tax brackets, and professional IRPF withholding:

  • Live Fiscal Regime Selector in Checkout Blocks (React Inner Block) & Classic Checkout: Customers can select Particular, Empresa / Autónomo, Minorista con Recargo de Equivalencia, or Profesional con Retención IRPF directly during checkout with instant extensionCartUpdate cart recalculation.
  • Multi-Rate Recargo de Equivalencia + Shipping: Simultaneous support for mixed carts with 21% IVA (+5.2% R.E.), 10% IVA (+1.4% R.E.), 4% IVA (+0.5% R.E.), and shipping surcharges.
  • IRPF Withholding for Spanish Freelancers (Retención de IRPF Autónomos -15% / -7%): Automatically deducts -15% or -7% IRPF on the net taxable base for Spanish B2B transactions.
  • WooCommerce PDF Invoices & Packing Slips Integration: Prints the customer’s NIF / CIF and itemized Recargo de Equivalencia and IRPF accounting tables (RD 1619/2012) directly on PDF invoices.

Installation

  1. Upload polmichael-recargo-equivalencia-for-woocommerce.zip via Plugins > Add New > Upload Plugin in your WordPress Admin dashboard.
  2. Activate the plugin through the Plugins menu.
  3. Go to WooCommerce > Fiscalidad España to configure your NIF / NIE / CIF validation rules and the roles subject to Recargo de Equivalencia.

FAQ

Is this plugin compatible with WooCommerce HPOS and Checkout Blocks?

Yes. The plugin explicitly declares compatibility with both custom_order_tables (HPOS) and cart_checkout_blocks, storing all order tax metadata through WC_Order CRUD methods and registering the NIF/CIF field in Checkout Blocks via woocommerce_register_additional_checkout_field().

Does it exclude the Canary Islands, Ceuta, and Melilla from Recargo de Equivalencia?

Yes. By law, Recargo de Equivalencia only applies in Peninsular Spain and the Balearic Islands. Orders from Las Palmas (GC), Santa Cruz de Tenerife (TF), Ceuta (CE), Melilla (ML), or outside Spain (ES) are automatically excluded.

Does it prevent corporate CIFs (S.L. / S.A.) from using Recargo de Equivalencia?

Yes. In accordance with Article 149 of the Spanish VAT Act (Ley 37/1992 del IVA), corporate entities (S.L., S.A.) cannot use Recargo de Equivalencia. The validator automatically detects corporate CIF prefixes and notifies the buyer.

Screenshots

Changelog

1.0.0

  • Initial release with full support for WooCommerce HPOS, Checkout Blocks (woocommerce_register_additional_checkout_field), geographic filtering, and algorithmic NIF/NIE/CIF validation.