VeriFactu on WooCommerce.
One WordPress hook and every order ends up at the AEAT.

WooCommerce · WordPress

WooCommerce runs most small ecommerce in Spain and its hook system is made for this. There is no Cofactu plugin on WordPress.org; there is a webhook and an add_action that calls it. If you would rather not touch PHP, Make or Zapier do the same, and the direct catalogue connection receives orders with no code.

No WordPress.org plugin · webhook and direct connection. Today there is no Cofactu plugin to install from WordPress.org, and no date for one. Two routes work: the universal webhook, which invoices and files with the AEAT, and the direct catalogue connection, which receives the shop's orders and prepares the invoice as a draft.

See how it connects ↓

No WordPress.org plugin · webhook and direct connection

What can you connect today
between WooCommerce and Cofactu?

Today there is no Cofactu plugin to install from WordPress.org, and no date for one. Two routes work: the universal webhook, which invoices and files with the AEAT, and the direct catalogue connection, which receives the shop's orders and prepares the invoice as a draft.

Status of the WooCommerce integration, checked against the Cofactu code
RouteTodayWhat it does
Cofactu plugin, module or app on WordPress.orgNot availableIt does not exist and has no date. There is nothing from Cofactu to install in the store.
Universal webhookAvailableInvoices every order you send and files it with the AEAT using your certificate. It needs an API key: from the SME plan or during the 30-day trial.
Direct catalogue connectionAvailableNo code, from the SME plan: Cofactu connects to the WooCommerce REST API. A paid order comes in as an order and, if you switch it on, as a draft invoice that you review and issue. For it to reach the AEAT without passing through you, use the universal webhook.
Make or ZapierAvailableWith their HTTP module against the webhook. Cofactu has no app of its own in Make or Zapier.

Checked on 26 October 2026 · What is not available has no date

Order-to-AEAT flow

From a paid order in WooCommerce
to a registered invoice.

  1. 01

    Order paid in your store

    WooCommerce fires its payment event, as it already does today.

  2. 02

    One POST to the Cofactu webhook

    From the native hook or from Make. Normalised JSON, API key in the header.

  3. 03

    Chained invoice

    Cofactu numbers it, computes the chained SHA-256 fingerprint and generates the PDF with a QR code.

  4. 04

    Registered with the AEAT

    With your certificate, the record goes to the AEAT (the Spanish Tax Agency) in the background and the response CSV is stored.

Scroll
With code · the native hook

woocommerce_payment_complete

It fires when the payment gateway confirms the charge. For cash-on-delivery or bank-transfer orders, also use woocommerce_order_status_completed. Save the file in wp-content/mu-plugins/ and it loads by itself.

php
<?php
// wp-content/mu-plugins/cofactu-verifactu.php
add_action('woocommerce_payment_complete', function (int $order_id): void {
    $order = wc_get_order($order_id);
    $lines = [];
    foreach ($order->get_items() as $item) {
        $subtotal = (float) $item->get_subtotal();          // excluding VAT
        $tax      = (float) $item->get_subtotal_tax();
        $lines[]  = [
            'descripcion'    => $item->get_name(),
            'cantidad'       => (float) $item->get_quantity(),
            'precioUnitario' => $subtotal / max(1, $item->get_quantity()),
            'tipoIva'        => $subtotal > 0 ? round($tax / $subtotal * 100) : 0,
        ];
    }
    $nif = $order->get_meta('_billing_nif');                 // the meta of your NIF plugin
    wp_remote_post('https://api.cofactu.com/api/webhooks/ecommerce-orders', [
        'headers' => [
            'Authorization' => 'Bearer ' . COFACTU_API_KEY,   // define() in wp-config.php
            'Content-Type'  => 'application/json',
        ],
        'body' => wp_json_encode([
            'platform'        => 'woocommerce',
            'externalOrderId' => (string) $order->get_id(),
            'client'          => $nif ? [
                'nif'          => $nif,
                'nombre'       => $order->get_formatted_billing_full_name(),
                'email'        => $order->get_billing_email(),
                'direccion'    => $order->get_billing_address_1(),
                'codigoPostal' => $order->get_billing_postcode(),
                'ciudad'       => $order->get_billing_city(),
                'pais'         => $order->get_billing_country(),
            ] : null,                                           // simplified F2 invoice
            'lines' => $lines,
        ]),
        'timeout' => 15,
    ]);
});
No code · direct connection

Direct connection from the Cofactu catalogue

Step 101

In WooCommerce, create REST API keys (Settings → Advanced → REST API) with read and write permission.

Step 202

In Cofactu, go to Catalogue → Public catalogue → Ecommerce integrations → “Connect WooCommerce”: name, shop URL and the two keys. Cofactu shows you the webhook secret once.

Step 303

In WooCommerce, create an order webhook (Settings → Advanced → Webhooks) pointing to the connection's “Webhook URL”, with that secret. Cofactu rejects anything not signed with it.

Step 404

“Sync products” pushes your Cofactu catalogue to the shop: name, reference, price, description and image. Stock is not synced from here.

Step 505

Each new order comes into Cofactu as an order. If it arrives paid and you have “Generate VeriFactu invoice automatically on payment” switched on, Cofactu prepares the invoice as a draft. If the shop resends the same order with changes, it is not touched: it is flagged for review.

No code

Without touching PHP: Make or Zapier

  1. Step 1

    Create an API key in Cofactu (Settings → API keys) with permission to create invoices. The API is included from the SME plan and during the 30-day trial.

  2. Step 2

    In Make, use the “WooCommerce → Watch Orders” module with status processing or completed; in Zapier, “WooCommerce → Order Paid” (WooCommerce needs the Zapier plugin to expose the trigger).

  3. Step 3

    HTTP module: POST to https://api.cofactu.com/api/webhooks/ecommerce-orders with Authorization: Bearer vf_live_….

  4. Step 4

    Map id to externalOrderId, billing to client and line_items to lines (subtotal / quantity is the unit price excluding VAT).

The JSON Cofactu expects

One format for every store

POST https://api.cofactu.com/api/webhooks/ecommerce-orders with Authorization: Bearer vf_live_…. Prices exclude VAT and each line carries its tipoIva (VAT rate); client: null issues a simplified F2 invoice; externalOrderId makes the call idempotent. From Settings → Integrations → Ecommerce you can send a test order, which stays as a draft; real orders show up in Invoices with their AEAT status.

Settings → Integrations → Ecommerce ↗
json
{
  "platform": "woocommerce",
  "externalOrderId": "2026-000123",
  "client": {
    "nif": "B12345678",
    "nombre": "Tienda Ejemplo SL",
    "email": "compras@ejemplo.com",
    "direccion": "C/ Mayor 1",
    "codigoPostal": "28001",
    "ciudad": "Madrid",
    "pais": "ES"
  },
  "lines": [
    {
      "descripcion": "Zapatillas running 42",
      "cantidad": 1,
      "precioUnitario": 79.34,
      "tipoIva": 21
    },
    {
      "descripcion": "Gastos de envío",
      "cantidad": 1,
      "precioUnitario": 4.13,
      "tipoIva": 21
    }
  ],
  "autoSubmit": true
}
Frequently asked questions

WooCommerce and VeriFactu, in short

Is there a Cofactu plugin for WooCommerce on WordPress.org?

No, and there is no date. Today you connect it in three ways: a twenty-line mu-plugin or Make/Zapier, which call the universal webhook, or the direct catalogue connection of Cofactu, which receives the orders and prepares the invoice as a draft.

Are the invoice PDFs my WooCommerce plugin generates valid for VeriFactu?

No. “PDF Invoices” plugins produce a document, but not an invoicing record with a chained hash, QR code and submission to the AEAT. You can keep using them as a delivery note or proof of purchase; the tax invoice is issued by Cofactu.

How do I collect the customer's NIF at checkout?

With any NIF/CIF field plugin for WooCommerce (there are free ones) that saves it as order meta, and by reading that meta in the hook. Without a NIF, client: null issues a simplified F2 invoice.

What if WordPress fires the hook again (retry, cache plugin…)?

The webhook is idempotent by platform + externalOrderId: the same order never produces two invoices. The second call returns the first invoice with its AEAT status.

Do I need a digital certificate for this to work?

For submission to the AEAT, yes: you upload it once to Cofactu and the webhook uses it on every order. Without a certificate, invoices are created as drafts and you send them when you have one. The JSON is the same for all four stores: platform, externalOrderId, client (or null for a simplified F2 invoice) and lines with a price excluding VAT and a tipoIva (VAT rate) per line.

Other platforms

Other platforms

  1. 01 Magento VeriFactu on Magento
  2. 02 Shopify VeriFactu on Shopify
  3. 03 PrestaShop VeriFactu on PrestaShop
  4. 04 Ecommerce Full ecommerce comparison
  5. 05 VeriFactu VeriFactu guide
Start with a test order

Your store stays on WooCommerce.
The invoice, VeriFactu.

30 days with all of Cofactu, API included and no card, and a test order to see the first chained invoice. After that, the API starts at the SME plan.

See pricing ↗

(Start today)

Invoice with VeriFactu, file with the AEAT and keep your books in the same account. Start free: no card, nothing to install.

Your first invoice

  • Unlimited VeriFactu invoices with QR
  • No card needed
  • Full export of your data