=== AgentVitrina ===
Contributors: pendent
Tags: ai, llms.txt, schema, woocommerce, structured data
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.4.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Make your WooCommerce store readable by AI agents: llms.txt, richer Product schema, AI agent visit stats. Coexists with Yoast and Rank Math.

== Description ==

AgentVitrina helps AI assistants (ChatGPT, Perplexity, Gemini, Claude...) understand your shop, without getting in the way of what you already have.

* **llms.txt that never overrides yours.** In the default "Auto" mode, `/llms.txt` (llmstxt.org format) is only served if nothing else serves it. A physical file, or a snippet or plugin that already serves it, always wins. Per-language variants (`/es/llms.txt`) are opt-in and never served when a physical root llms.txt exists. There is an optional alternative path, `/agentvitrina-llms.txt`.
* **Schema enrichment, never duplication.** When Yoast SEO, Rank Math or WooCommerce already output a Product node, AgentVitrina only adds missing fields through their filters: a VAT-inclusive price (never 0), priceValidUntil (opt-in), shippingDetails, hasMerchantReturnPolicy and GTIN. It never prints a second Product node. If nothing on the page produced a Product node (for example Yoast SEO without its WooCommerce add-on on some themes), AgentVitrina prints one Product node of its own; variable and grouped products get an AggregateOffer (lowPrice, highPrice, offerCount) as displayed in your shop.
* **Multilingual.** Polylang and WPML: llms.txt is built for the current language, with the current language's permalinks and prices.
* **AI agent visit stats (opt-in).** Off by default. When enabled, visits are counted server-side from the user agent only, with one atomic SQL increment per agent hit in a small table (day, agent, count; 30 days). No IPs and no user agents are stored.
* **Safe mode by default.** No cookies, no JavaScript, no front-end assets and no remote calls.

= External services =

None by default. Everything above (llms.txt, schema, AI agent visit counting) works fully without an account or any remote call, and no included feature is locked.

Optionally, you can connect the shop to the hosted AgentVitrina service ("core"), which provides an agent-ready catalog feed with tracked links back to your own product pages (formats that follow the ACP and UCP protocols), an MCP endpoint, per-agent order attribution reports and an EU compliance validator. Shoppers always buy in your own WooCommerce checkout; nothing is sold or paid inside an AI chat. This hosted service requires a free AgentVitrina account with a verified email address.

* What is sent, and when:
  * When you click "Send verification email": your email address, your site URL, your WordPress language, the platform name, a random connection code, and your consent choices (Terms/Privacy, required; product news, optional and unticked by default).
  * When you click "Check connection": the connection code and your site URL. The service returns a per-shop API key, stored in this plugin's settings.
  * Once connected (or if you enter an API key manually): a daily WP-Cron job sends your published catalog: product id, SKU, GTIN, name, short description, URL, image URL, net price, currency and availability, plus your store name, URL, country and currency.
  * Once connected, for orders that came from an AI assistant only: when the order reaches processing or completed, the order number, order total, currency, your store id and the assistant name (e.g. "chatgpt") are sent once. No customer name, email, address, IP or cart contents are sent. Queued with Action Scheduler when available (up to 3 tries), otherwise one non-blocking request. Sending therefore relies on WP-Cron / Action Scheduler running on your site (it is triggered by site traffic unless you use a real server cron); if WP-Cron is disabled without a system cron, attribution reports are delayed until it runs. Deactivating or uninstalling the plugin cancels any queued sends.
* Nothing is sent during page rendering, and nothing is sent while the core endpoint is empty. Requests use HTTPS. The plugin never processes payments.
* Service: AgentVitrina (the core endpoint you configure). Terms of use: https://{{DOMAIN}}/legal/en/terminos.html. Privacy policy: https://{{DOMAIN}}/legal/en/privacidad.html. PLACEHOLDER: {{DOMAIN}} is replaced with the public domain before WordPress.org submission.
* You can unsubscribe from any email with one click, and export or delete your account data at any time from your account page.

== Installation ==

1. Upload and activate. It works immediately in safe mode.
2. Optional: go to WooCommerce > AgentVitrina to set shipping and return details for the schema, and the optional core endpoint.

== Frequently Asked Questions ==

= I already have an llms.txt. =

It will be left untouched. Auto mode yields to physical files and to any snippet or plugin that serves the URL.

= Will I get duplicate Product schema? =

No. In "Enrich" mode (the default) existing nodes are enriched; AgentVitrina prints its own node only when no other plugin, theme hook or WooCommerce produced one for that page. "Standalone" only applies when no SEO plugin is active, and it replaces WooCommerce's own node.

= How do I remove everything? =

Deactivate the plugin to stop all output. To remove all data, use Plugins > Deactivate, then Delete in the WordPress admin, or run `wp plugin uninstall agentvitrina --deactivate` (add `--skip-delete` to keep the files). Either way runs uninstall.php, which removes the options, transients, cron event and (if the counter was ever enabled) the counter table. Note: `wp plugin delete` only removes the files and does NOT run uninstall.php, so the data would stay.

== Changelog ==

= 0.4.3 =
* New: admin translations for Spanish (es_ES), French (fr_FR), Italian (it_IT) and Catalan (ca); .pot included in /languages.

= 0.4.2 =
* Fix: product pages with no Product schema at all (e.g. Yoast SEO free + WooCommerce data not output) now get one AgentVitrina Product node; never a duplicate.
* Fix: variable and grouped products use AggregateOffer (lowPrice, highPrice, offerCount, priceCurrency); never an Offer without a price.
* Fix: deactivate and uninstall cancel queued attribution sends (Action Scheduler) as well as the daily sync cron event.
* Settings: an admin error is shown when the core endpoint is rejected (must be https).
* Readme: attribution sending relies on WP-Cron / Action Scheduler.

= 0.4.1 =
* Declares "Requires Plugins: woocommerce" (WordPress 6.5+ dependency handling).
* Coding-standards cleanup (WPCS); no functional changes.

= 0.4.0 =
* Order attribution to AI assistants (only when the shop is connected): the source (utm_source, then referrer, then a user-initiated assistant user agent) is taken from WooCommerce's own order attribution data or an already-started WooCommerce session, stored on the order, and sent once (order number, total, currency) to the core when the order reaches processing/completed. No cookies or scripts are added. Uses Action Scheduler when available.

= 0.3.0 =
* Optional "Connect to AgentVitrina": free account with a verified email, then a per-shop API key (automatic handshake or paste). Local features unchanged without an account.
* Store id now matches the core (host and port, dots as dashes).

= 0.2.1 =
* llms.txt: language-prefixed variants are opt-in (off by default) and never served when a physical root llms.txt exists.
* AI agent counter off by default; when on, atomic SQL increments in a custom table (no lost counts, no option rewrites).
* priceValidUntil off by default. Never adds a price <= 0 or for variable/grouped products.
* Yoast / Rank Math detected only by their own constants/classes.
* Cache cleanup via delete_transient (object-cache safe). Precise Google agent tokens. Author header.

= 0.2.0 =
* llms.txt coexistence (off / auto / on) and an alternative path.
* Schema enrichment for Yoast, Rank Math and WooCommerce. No duplicate Product node.
* Polylang and WPML awareness.
* Removed the cookie-based attribution. Visits are now counted server-side from the user agent.
* Optional daily catalog sync (off by default).
* Full uninstall cleanup.

= 0.1.0 =
* First version.
