=== Influblog Creator & Affiliate ===
Contributors: influblog
Tags: woocommerce, affiliate, creators, coupons, pr
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.0.9
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
WC requires at least: 9.0
WC tested up to: 11.3

Connect a WooCommerce store to Influblog for creator programs, affiliate coupons, PR fulfillment and catalog sync.

== Description ==

Influblog Creator & Affiliate connects your store to the Influblog platform. Once the store owner starts the connection and approves it in Influblog, the plugin:

* syncs your catalog to Influblog (products, variations, prices, stock, SKU, categories, images and permalinks),
* sends order attribution events for created, paid, cancelled, refunded and tracked orders,
* creates and updates creator test and affiliate coupons from Influblog,
* creates zero-value PR fulfillment orders with tracking references,
* publishes a creator program page and provides creator program and showcase embeds,
* exposes a top-level **Influblog** menu in WordPress with the full embedded Influblog app.

The plugin is opt-in. It sends no data to Influblog before the store owner connects it, and the connection can be removed at any time inside Influblog.

**Requirements**

* WordPress 6.5 or newer
* WooCommerce 9.0 or newer
* PHP 8.1 or newer
* WooCommerce High Performance Order Storage (HPOS) is supported
* Cart and Checkout blocks are supported

**Privacy and consent**

The plugin integrates with the [WP Consent API](https://wordpress.org/plugins/wp-consent-api/). The Influblog click id cookie (`ifb_click_id`) is only written after marketing consent, and the landing URL is only stored after statistics consent. Without a consent management plugin no marketing cookie is written. Coupon codes entered through `?ib_coupon=CODE` (or `?ifb_coupon=CODE`) are stored as functional cart session data and applied without marketing consent.

The plugin does not load a third-party tracking pixel. Order attribution is sent server-side to Influblog after checkout.

== External services ==

This plugin connects to the Influblog platform, operated by Influblog. There is no other external service.

**Service endpoints**

* `https://brand.influblog.com` — Influblog API (`/api/wordpress/*`) and embedded dashboard (`/embed/wordpress`, `/connect/wordpress`)
* `https://creator.influblog.com` — creator program form and campaign showcase embeds (`/embed/forms/*`, `/embed/brands/*`)

**When data is sent**

Only after the store owner starts the connection and approves it in Influblog. Requests stop after Disconnect. The plugin also makes a server-to-server request when a WordPress privacy erasure request is confirmed.

**Data sent**

* Pairing: site URL, admin return URL, WordPress and WooCommerce versions, HPOS and multisite flags, store name, currency, locale, administrator email address, requested connection mode, and a SHA-256 hash of a one-time pairing secret.
* Catalog sync: product and variation IDs, titles, descriptions, SKU, prices, stock quantities, status, categories, images, permalinks and currency.
* Order events: order ID, order number, status, currency, totals, discounts, shipping, tax, coupon codes, line items, customer email address, customer ID, Influblog click id (only after marketing consent), landing URL (only after statistics consent), refund amount, tracking number/provider/link and PR reference.
* Jobs: coupon creation and updates, PR fulfillment order creation, creator program page creation and tracking refresh. These write data into your own WordPress store (coupons, orders, pages).
* Privacy erasure: a salted SHA-256 hash of the customer email address. The raw email address is not sent.

**Privacy and terms**

* Influblog privacy policy: https://influblog.com/privacy
* Influblog terms: https://influblog.com/terms
* Influblog contact: https://influblog.com/contact

== Installation ==

1. Upload the `influblog-creator-affiliate` folder to `/wp-content/plugins/`, or install the ZIP from Plugins → Add New → Upload Plugin.
2. Activate the plugin through the Plugins screen.
3. Go to **Influblog** in the WordPress admin menu and choose **Connect Store** or **Connect existing Influblog account**.
4. Approve the connection in Influblog. You are returned to the **Influblog** app screen with the store connected.

== Frequently Asked Questions ==

= Does the plugin work with HPOS? =

Yes. Orders are read and written through the `WC_Order` CRUD API, and the plugin declares compatibility with custom order tables and the cart/checkout blocks.

= Does the plugin send data before I connect? =

No. Every API request is skipped while the store is disconnected. Pairing starts only when an administrator clicks a connect button.

= Where are coupons and PR orders created? =

Inside your own WooCommerce store. Coupons are created with `WC_Coupon` and PR orders with `wc_create_order`; Influblog only receives the resulting identifiers and status.

= What happens on uninstall? =

Uninstall removes the plugin's options, transients and scheduled jobs. Orders, coupons, creator program pages and other store content are preserved.

== Changelog ==

= 1.0.9 =
* Creator orders get a real WooCommerce customer account: an existing user by e-mail is linked, otherwise an account is created and past guest orders are attached, so the verified-owner review gate passes.
* Coupon and PR jobs carry the brand name, brand locale and creator first name, written onto the order and coupon for the creator-facing note.
* AST shipment data always wins over the completed-status fallback.


= 1.0.8 =
* Universal shipment trigger: a completed WooCommerce order counts as shipped even without a tracking plugin; custom shipped/delivered statuses and notes work the same way.
* One-time personal welcome note (TR/DE/EN) as a public customer note when a creator order ships, mailed through the shop's SMTP.
* Carrier display names resolve from AST's provider table instead of raw slugs.


= 1.0.7 =
* Shipment tracking: AST/AST Pro, TrackShip, AfterShip, Germanized and Turkish cargo metadata plus a multi-language order-note sniffer (customer and private notes) feed the Influblog task with carrier, tracking number, URL and SHIPPED/DELIVERED state.
* A fallback metabox for shops without a shipping plugin, hidden automatically when AST or a similar plugin is active.


= 1.0.6 =
* Coupons carry a description naming the creator, and the description is updated on re-issued codes.
* DEACTIVATE_COUPON switches a coupon off idempotently; a later create re-activates it.
* The WordPress menu uses the official Influblog mark.


= 1.0.5 =
* The account pairing popup opens synchronously inside the click (real user activation), so Chrome, Safari and Firefox no longer block it. The pairing code is fetched from admin-ajax afterwards; nothing opens on page load.


= 1.0.4 =
* A revoked pairing (401/403 from the embedded launch or the job poll) now clears the dead local connection and opens the connect screen with the account pairing popup instead of a dead end.
* The fallback card offers a nonce-protected "Reconnect Influblog account" action.
* `?ib_reconnect=1` and `?ib_asset=` open the reconnect flow directly.


= 1.0.3 =
* SYNC_PRODUCTS job: a manual product sync from the Influblog products page now starts the plugin's own catalog run.


= 1.0.2 =
* Consent defaults to allowed when the shop has no consent management plugin; an active CMP opt-in is respected.
* Adds WP Consent API cookie information and the WordPress privacy-policy disclosure with the Influblog privacy link.

= 1.0.1 =
* Added the top-level **Influblog** WordPress menu with the full-screen embedded app and an **Open App** plugin action link.
* Unified the product name as **Influblog Creator & Affiliate** across the plugin, admin and translations.
* Changed the WordPress.org slug and text domain to `influblog-creator-affiliate`; the admin screen now lives at `admin.php?page=influblog-creator-affiliate`.
* Fixed the `Visit plugin site` URL.

= 1.0.0 =
* Initial release: pairing, embedded dashboard, catalog sync, order events, consent-aware attribution, coupon jobs, PR fulfillment orders, creator program page and embeds, privacy tools.

== Upgrade Notice ==

= 1.0.2 =
Consent-safe attribution without blocking shops that have no CMP.

= 1.0.1 =
Adds the full-screen app shell and the official Influblog Creator & Affiliate name.

= 1.0.0 =
Initial release.
