Skip to content

WooCommerce integration

The official WordPress plugin (PHP 8.1+, WooCommerce 7+) handles order, refund, coupon, product, and subscription lifecycle events. Source lives in plugin/cobalz-affiliate in the GitHub repo; the ZIP is downloadable from your merchant dashboard once paired.

Install

  • Download the plugin ZIP from Settings → Store connection.
  • WordPress admin: Plugins → Add New → Upload Plugin → activate.
  • The new Cobalz Affiliate menu appears in the WP admin sidebar.
  • Enter the pairing code from your dashboard, save.

The plugin POSTs a heartbeat every 60 seconds. Your merchant dashboard's green-dot indicator flips to Connected as soon as the first one lands.

Hooks it subscribes to

  • woocommerce_checkout_order_processed → push order, resolve attribution.
  • woocommerce_order_refunded → refund clawback logic.
  • woocommerce_applied_coupon → stamp session with affiliate via coupon.
  • woocommerce_subscription_* → recurring commission lifecycle.
  • woocommerce_new_product → keep product catalog synced.

Durable outbox

Every webhook is written to a WordPress option (wp_cobalz_outbox) and flushed on the next tick with HMAC signing. If your store loses internet for an hour, the outbox replays automatically when connectivity returns. Body cap: 2 MB. HMAC algorithm: SHA-256 over {timestamp}.{body}.

Auto-inject the tracker

Toggle Settings → Tracker → Inject t.js to have the plugin add the<script> tag to the storefront on every page. Skip this if you prefer to add it to your theme manually.

Troubleshooting

Green dot stays red

  • Confirm the WP cron is firing (wp cron event list).
  • Check the outbox table — if it's growing, the HMAC secret is mismatched. Re-pair.
  • Look at WP_DEBUG_LOG for cobalz_outbox_failed entries.

Orders not creating commissions

  • Did the customer arrive with ?ref= or a coupon? Check the affiliate's click log.
  • Is the cookie domain right? The tracker writes to the apex domain by default.
  • Look at the order in your dashboard — attributed_via should be cookie, coupon, or url_param.
Note:For Subscriptions support you need the WooCommerce Subscriptions extension installed. Without it, the recurring hooks are no-ops and you only get commissions on the parent order.