=== uReferrals for WooCommerce ===
Contributors: ureferrals
Tags: affiliate, referral, woocommerce, tracking, commission
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 1.0.0
License: MIT
License URI: https://opensource.org/licenses/MIT

Automatic affiliate tracking + conversion attribution for WooCommerce. Works with any payment gateway — Stripe, PayPal, Klarna, offline.

== Description ==

uReferrals gives you a flat-rate referral platform for your WooCommerce store, without taking a percentage of your affiliates' commissions.

This plugin does three things:

1. Installs the uReferrals tracker on every page of your site so visitors arriving with `?ref=<code>` in the URL are automatically attributed.
2. Persists the referral through WooCommerce checkout — the ref survives session regeneration, cookie clearing during payment redirects, and slow checkouts.
3. Reports the conversion to uReferrals when the order is marked completed or processing. Fires once per order, idempotent.

Works with any WooCommerce payment gateway. Stripe, PayPal, Klarna, offline bank transfer — all supported. No code changes required on your store.

**Requirements:**

* WordPress 6.0+
* WooCommerce 6.0+
* PHP 7.4+
* A uReferrals account with a program set up (grab the publishable + API keys from your program's API page).

== Installation ==

1. Install and activate the plugin from Plugins → Add New.
2. Go to Settings → uReferrals.
3. Paste your Publishable key (`uref_pk_…`) and API key (`urk_…`) from your uReferrals dashboard → Programs → your program → API.
4. Optional: set the Cookie domain to `.yourdomain.com` (leading dot) if your marketing site and checkout are on different subdomains.
5. Save. The tracker is live immediately.

== Frequently Asked Questions ==

= Does this work with payment gateways other than Stripe? =

Yes. The plugin hooks into WooCommerce's own order lifecycle, not any specific payment gateway. Stripe, PayPal, Klarna, Cash on Delivery, custom gateways — all fire the same order-completed hook.

= What happens if my site's marketing pages are on `example.com` and my checkout is on `shop.example.com`? =

Set the "Cookie domain" field to `.example.com` (with the leading dot). This makes the referral cookie visible across every subdomain of your parent domain, so the ref survives the hop.

= What if a customer refunds their order? =

The plugin marks the refund locally. Automatic clawback via API is coming in a follow-up release. Until then, the affiliate is paid the commission as scheduled — you can manually adjust via the uReferrals dashboard if needed.

= Does the plugin send any personal data to uReferrals? =

Only the customer's email (used as an opaque identifier to dedupe recurring purchases from the same customer) and the order total. No product data, no shipping address, no payment details.

== Changelog ==

= 1.0.0 =
* Initial release. Tracker injection, WooCommerce session capture, order-completed conversion reporting, refund logging.
