# WooCommerce

> The native connector with signed webhooks, the checkout consent field, and the snippet that carries the link token all the way to the order.

Fuente / source: https://soporte.konverda.com/en/docs/developers/woocommerce
Idioma / language: en
Actualizado / updated: 2026-08-26

---
WooCommerce is a **native integration**: the store signs every webhook with a secret this platform generates — you only paste it. Orders arrive with cryptographic verification, with no token in the URL.

The card is in the app, under **«Ajustes → Integraciones → WooCommerce»** (settings → integrations → WooCommerce).

## Connecting {#connect}

:::pasos
1. On the WooCommerce card, press **«Generar secreto»** (generate secret) and copy it. **It is shown only once.**
2. Copy the card's **webhook URL** too.
3. In your store: **WooCommerce → Settings → Advanced → Webhooks → Add webhook**.
4. Any name · Status **Active** · Topic **Order updated** · Delivery URL = the URL you copied · Secret = the secret you copied · API **v3**.
5. Save and place a test order. The card's activity should reflect it within seconds.
6. Optional: on the card, adjust the phone prefix (34 for Spain), the automatic tag, the checkout consent field and the statuses that count as paid.
:::

## The checkout consent field {#consent}

The card's **«Campo de consentimiento del checkout»** (checkout consent field) is the name of the order *meta* where your store keeps the checkbox (for example with Checkout Field Editor). That meta is what the platform reads as `consent` — and it is what decides the contact's level.

| Situation | Basis recorded | Resulting opt-in | What they can receive |
|---|---|---|---|
| Meta configured and the checkbox ticked | `checkbox` | «Marketing» | Everything: campaigns, waves, `order.paid` automations and 1:1 templates. Lifts a previous opt-out (an explicit act by the customer). |
| Meta configured and the order carries it with a false value | — (no registration recorded) | Unchanged | The sale is only recorded if they were already a registered contact; if not, no profile is created. |
| Consent field EMPTY on the card — or configured but the order does not carry that meta | `purchase` | «No» | Only replies when the person writes. The `order.paid` automation is NOT sent. A previous opt-out is always respected. |

:::aviso
If you leave the «Campo de consentimiento del checkout» empty, **every paid order registers the contact at level «No»**: they will still show up in **«Contactos»** (contacts) and you will be able to reply to them, but no campaign or proactive automation will reach them. For your buyers to be marketing contacts you need a real checkbox at the checkout and its meta configured here.
:::

## Linking the sale to the link that brought it {#wtk}

*Optional, but it is the only way to attribute a sale whose phone number we do not recognise.*

The links the platform sends append `?wtk=<token>` to the destination URL. WooCommerce **does not store it on its own**: this snippet is needed in your store so that the token travels all the way to the order. With it, an order whose phone number we do not recognise can still be attributed to the contact who received the link (it shows as «vía enlace» — via link).

Paste it into your **child theme**'s `functions.php`, or into a snippets plugin:

```php
// Konverda — vincula la venta con el enlace que la trajo.
add_action( 'init', function () {
    if ( isset( $_GET['wtk'] ) && ! headers_sent() ) {
        $wtk = substr( sanitize_text_field( wp_unslash( $_GET['wtk'] ) ), 0, 64 );
        if ( $wtk !== '' ) {
            setcookie( 'wtk', $wtk, time() + 30 * DAY_IN_SECONDS, COOKIEPATH ?: '/', COOKIE_DOMAIN, is_ssl(), true );
        }
    }
} );

add_action( 'woocommerce_checkout_create_order', function ( $order ) {
    if ( ! empty( $_COOKIE['wtk'] ) ) {
        $order->update_meta_data( 'wtk', substr( sanitize_text_field( wp_unslash( $_COOKIE['wtk'] ) ), 0, 64 ) );
    }
}, 10, 1 );
```

:::aviso
Without this snippet, link attribution **does not work** on WooCommerce — attribution will only be able to lean on the order's phone number. Store the meta under the exact key `wtk` (`_wtk` is also accepted). If you use page caching, check that the request carrying `?wtk=` is not served from cache.
:::

## Read next {#read-next}

- [The marketing opt-in and «Añadir a marketing»](/en/docs/contacts-and-consent/the-marketing-opt-in)
- [Opt-outs and what the platform remembers](/en/docs/contacts-and-consent/opt-outs-and-what-the-platform-remembers)
- [Orders API (generic connection)](/en/docs/developers/orders-api) — the route for everything that is not Woo.
