=== Facet for WooCommerce ===
Contributors: facetllc
Tags: woocommerce, agents, agentic commerce, agents-txt, facet
Requires at least: 6.4
Tested up to: 7.0.2
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect your WooCommerce store to the Facet Terminal for agent commerce: discovery, one-click connect, fast order lookup, and Facet-order email suppression.

== Description ==

Facet for WooCommerce connects your store to the Facet Terminal so AI shopping agents can discover, quote, and buy from you.

* **Agent discovery.** Advertises your Terminal via an `agents.txt` pointer in your site `<head>`, and can optionally serve `/.well-known/agents.txt` and `/.well-known/facet-association.json` from your domain.
* **One-click connect.** Links your store to Facet over the standard WooCommerce `wc-auth` handshake. Facet never receives your admin password; your store approves read/write API access directly.
* **Fast order lookup.** An authenticated REST route lets the Terminal resolve a Facet order to your Woo order id instantly (no full-history scan).
* **Email suppression.** Customer emails are automatically suppressed for orders an agent created through Facet, so shoppers aren't double-notified.

The plugin is compatible with WooCommerce High-Performance Order Storage (HPOS) and legacy order storage.

== External services ==

This plugin connects your store to the Facet Terminal, an external service operated by Facet, LLC, so AI shopping agents can discover, quote, and buy from you. The plugin is inert until you enter a Terminal URL and connect your store: no data leaves your site before that.

What is sent, and when:

* On connect: your store URL and Facet Site ID are sent to the Facet admin at app.facet.llc to begin the standard WooCommerce authorization handshake. WooCommerce core, not this plugin, then issues the scoped API keys directly to Facet.
* On agent order lookup or refund: when the Terminal resolves or refunds an order that an agent placed through Facet, order identifiers and refund amounts are exchanged over an authenticated, signed request. Only Facet orders are involved; ordinary store orders are never sent.

The service is operated by Facet, LLC. By connecting your store you agree to the Facet Terms of Service and Privacy Policy:

* Terms of Service: https://facet.llc/legal/terms.html
* Privacy Policy: https://facet.llc/legal/privacy.html

== Installation ==

1. Install and activate the plugin (WooCommerce must be active).
2. Go to **WooCommerce → Facet**.
3. Enter your Terminal URL and Facet Site ID (from your Facet onboarding).
4. Click **Connect to Facet** and approve access when your store prompts you.

== Frequently Asked Questions ==

= Does Facet get my admin password? =
No. Connecting uses WooCommerce's built-in `wc-auth` flow: your store issues scoped API keys directly to Facet. The plugin never handles those keys.

= Will my customers still get order emails for agent orders? =
No. Customer emails are suppressed for orders created through Facet. Normal (non-Facet) orders email as usual. You can re-enable specific emails with the `facet_ffw_suppress_email` filter.

= Does this work with HPOS? =
Yes. The plugin declares HPOS compatibility and uses only HPOS-safe order APIs.

== Changelog ==

= 1.0.1 =
* Adds non-custodial refund handling. A merchant can approve and sign refunds for agent orders from their own wallet, on the order's own chain, directly from the WooCommerce order screen.

= 1.0.0 =
* Initial release: agent discovery, wc-auth connect, order-lookup REST route, and Facet-order email suppression.

== Upgrade Notice ==

= 1.0.1 =
Adds merchant-approved, non-custodial refunds for agent orders.

= 1.0.0 =
Initial release.
