Docs/Shops/WooCommerce

WooCommerce#

The WooCommerce integration uses Karla's public API and WooCommerce's native webhooks. You don't need a plugin — just point WooCommerce's webhook system at Karla and you're done.

What you need#

  • A WooCommerce store (WordPress 5.0+ with WooCommerce 3.5+)
  • Admin access to your WooCommerce dashboard
  • A Karla API key (generate one under Settings → API Keys in your Karla portal)
  • Your Karla shop slug

Overview#

Karla ingests orders and tracking updates through a set of HTTP endpoints. WooCommerce can push data to those endpoints natively via webhooks, which means integration is a matter of configuration — no code, no plugin.

You'll configure three webhooks:

  1. Order created — when a customer completes checkout.
  2. Order updated — when an order status changes (e.g. processingcompleted).
  3. Order deleted — when an order is cancelled or removed.

Karla receives each event, normalizes the payload, and begins tracking the shipment as soon as a tracking number is attached.

Step 1 — Generate your Karla API key#

  1. Sign in to the Karla Portal.
  2. Navigate to Settings → API Keys.
  3. Click Create API Key, pick the editor role, and copy the generated key.
  4. Note your shop slug — it appears at the top of every Karla portal page.

Keep the key and slug handy; you'll paste them into WooCommerce.

Step 2 — Create the webhook endpoint URL#

Karla's order webhook endpoint is:

https://api.gokarla.io/v1/shops/{your-shop-slug}/orders/woocommerce

Replace {your-shop-slug} with your actual slug.

Step 3 — Configure WooCommerce webhooks#

  1. In your WordPress admin, go to WooCommerce → Settings → Advanced → Webhooks.

  2. Click Add webhook.

  3. For each of the three events, create a webhook with these settings:

    FieldValue
    NameKarla — Order created (adjust per topic)
    StatusActive
    TopicOrder created / Order updated / Order deleted
    Delivery URLhttps://api.gokarla.io/v1/shops/{your-shop-slug}/orders/woocommerce
    SecretLeave empty (Karla authenticates with the header below)
    API VersionWP REST API Integration v3 (latest)
  4. Click Save webhook.

Step 4 — Add the Karla authorization header#

WooCommerce doesn't expose a headers field in the webhook UI by default. Use the Webhook Tools plugin or a small snippet in your theme's functions.php:

add_filter(
  'woocommerce_webhook_http_args',
  function ($http_args, $arg, $id) {
    $webhook = wc_get_webhook($id);
    if (str_contains($webhook->get_delivery_url(), 'api.gokarla.io')) {
      $http_args['headers']['Authorization'] = 'Basic ' . base64_encode(
        '{your-shop-slug}:{your-karla-api-key}'
      );
    }
    return $http_args;
  },
  10,
  3
);

Replace {your-shop-slug} and {your-karla-api-key} with your actual values. This attaches HTTP Basic auth to every request Karla receives.

For production setups we recommend storing credentials in wp-config.php constants or a secrets manager, not directly in functions.php.

Step 5 — Verify#

  1. Place a test order in your WooCommerce store.
  2. Open the Karla Portal → Orders view — your test order should appear within a few seconds.
  3. Update the order status in WooCommerce (e.g. mark as completed) and verify Karla reflects the change.

If an order doesn't appear, check WooCommerce → Settings → Advanced → Webhooks → Logs for delivery errors (most commonly a 401 — double-check the authorization header).

Tracking numbers#

When you add a tracking number to an order in WooCommerce (via a plugin such as Advanced Shipment Tracking or the native meta field), include it in the order's line-item or order meta and WooCommerce will pass it along on the next Order updated webhook. Karla reads these standard meta keys:

  • _tracking_number
  • _tracking_provider (or _tracking_carrier)

For custom setups, you can also push tracking numbers directly to Karla using the shipments endpoint.

Next steps#

Was this helpful?