EarnedStats Docs

Revenue

WooCommerce

Send WooCommerce sales to EarnedStats.

1. Add the webhook

WordPress, WooCommerce, Settings, Advanced, Webhooks. Add one with topic "Order updated" and the address below.

Endpoint
https://earnedstats.com/api/webhooks/woocommerce/YOUR_SITE_ID

Events: order.updated.

2. The secret

Make up a secret, use it there and paste the same one here. Save it in Settings, Revenue, WooCommerce.

3. The visitor id

The script adds the visitor id to the checkout form. Save it to the order with this snippet in your theme or a snippets plugin:

Code
add_action('woocommerce_checkout_create_order', function ($order) {
  if (!empty($_POST['es_visitor_id'])) {
    $order->update_meta_data('es_visitor_id', sanitize_text_field(wp_unslash($_POST['es_visitor_id'])));
  }
});