== Changelog ==

Every Emporiqa release, newest first. readme.txt shows the two most recent.

= 1.2.3 =
* Fix: password-protected pages and products are no longer synced, so the chat cannot repeat what only visitors with the password can see. One already in Emporiqa is removed when it is saved or at the next Sync All, and a password-protected translation is left out of the page or product it translates.
* Fix: page content is read as a signed-out visitor when it is synced. Shortcodes and blocks that show more to signed-in users (members-only sections, a greeting with your name) no longer send that to the chat when an admin runs Sync All.
* Fix: the limits on how often Emporiqa can look up orders, prices and customer info now hold when several lookups arrive at the same moment.
* Changed: Order status answers kept for Emporiqa's retries are deleted at the next lookup Emporiqa makes after their 10 minutes are over, instead of staying in the database until WordPress's daily cleanup.
* Changed: the Emporiqa server URL under Advanced must start with https://. Any other address is refused and the previous one is kept.

= 1.2.2 =
* Fix: on a store where Polylang translates product types (the type then carries a language, such as simple-en), those products were never included in Sync All, and a Sync All removed one from the chat after a save had sent it. They are synced now, and the Sync tab counts them.
* Fix: a product created only in a second language, with no product in your default language it translates, is no longer sent to Emporiqa labelled as your default language; it is sent once it is linked to a default-language product. One sent by an earlier version is removed the next time it is saved.
* Fix: products whose Catalog visibility is Hidden are no longer synced, and one already in Emporiqa is removed when it is saved or at the next Sync All. "Shop only" and "Search results only" products stay synced, since shoppers can still find them in your store.
* New: the Sync tab says when the last automatic change could not be sent to Emporiqa, with the time and the reason, until a change goes through again or a Sync All completes. Before, this was only in the PHP error log with debugging on.
* Fix: Test Connection previews a product in your default language; it could preview a translation under the default language's code.
* New: the customer info action (`actions/customer-info`). Emporiqa can ask this site for a signed-in shopper's account name and email and their 10 newest orders (number, date, status, total), so the chat can answer "where is my order?" without asking for the number. Only that customer's own orders, never a checkout draft; the `emporiqa_customer_info_data` filter lets you remove fields or add your own.
* Changed: only your WordPress Pages are synced as pages. The "Pages and posts to include" setting is gone: blog posts and other content types are no longer sent, and ones sent before are removed at the next Sync All.
* Changed: a product of a type you left out with the `emporiqa_product_types` filter is removed from Emporiqa when it is saved, not only at the next Sync All, and gets no stock updates.

= 1.2.1 =
* Removed: the older order tracking endpoint; use the ready-made Order status rule in Emporiqa.
* Changed: the Order Tracking API URL field and the "Order tracking (old)" switch under Advanced are gone, and their settings are deleted when you update. The `emporiqa_order_tracking_data` filter still adds tracking numbers to Order status.
* New: Order status answers with the whole order, as the old order tracking did: order number, name, items with variant, SKU, quantity and price, subtotal, shipping, tax, fees, discount and total, payment method and whether it is paid, shipping method, and the shipping and billing addresses. Amounts are in the order's currency, with tax as your shop shows prices. The email is never sent back.
* New: the `emporiqa_order_status_data` filter runs after all of this is filled, so you can change any of it or add your own fields under `extra`.

Older entries are in changelog.txt, shipped with the plugin.

= 1.2.0 =
* New: Order status, a ready-made rule. Shoppers ask "where is my order?" and the chat answers from your WooCommerce orders: status, order date and tracking numbers (WooCommerce Shipment Tracking and Advanced Shipment Tracking are read when installed). A signed-in shopper only gives the order number; a guest also gives the order's email. Settings > Emporiqa shows the Order status address to copy into the rule in Emporiqa, and whether the rule is on.
* Changed: a signed-in shopper's identity is no longer written into the page or the chat script's URL, where a full-page cache could hand it to another shopper and server logs could keep it. The chat asks for it when it opens, from an uncached request.
* Changed: the old order tracking keeps working as before and stays on. Where ready-made rules are offered it moves under Advanced, with how to switch it off once the Order status rule replaces it.
* Changed: sync requests are also signed with Emporiqa's newer per-purpose keys and carry the plugin version; connecting proves the request came from your site; a connection Emporiqa holds for an owner's approval shows Emporiqa's own explanation.
* Changed: prices are sent as your shop shows them. A shop that enters prices without tax but shows them with tax (or the reverse) used to send the entered amount; prices with and without tax are now both sent when taxes are on.
* Fix: prices are always synced as a signed-out visitor sees them, with tax at your shop's address. A role, B2B or wholesale pricing plugin could otherwise send the price of whoever saved the product or ran the sync as the public price. The chat's cart now shows each item's price with or without tax as your cart page does.
* Fix: Sync All pages through products and pages by id, so a product changed during a sync can no longer be skipped and then removed from Emporiqa.
* Fix: an order conversion that Emporiqa could not receive after every retry is sent again at the order's next paid status.
* Changed: a language you did not tick under Languages (Polylang or WPML) is neither synced nor offered: its pages show no chat.
* New: customer prices. Emporiqa can ask this site for a signed-in shopper's own prices (`actions/customer-prices`), read by WooCommerce as that shopper with tax for their address. WooCommerce has one price per product, so this is your public price unless a role, B2B or wholesale pricing plugin gives that customer another; only prices are returned, and products the shopper cannot see are left out.
* New: quantity price tiers. The Tiered Price Table plugin's tiers are sent when it is active, and the `emporiqa_price_tiers` filter lets any other quantity-pricing plugin send its own (WooCommerce has none of its own); each tier is the unit price the cart charges, with tax as your shop shows prices.
* Changed: the signed-in shopper's token request requires a custom header and refuses cross-site requests; guests no longer reach it at all.
* Fix: the old order tracking reads a typed number only as an order number, never as another order's internal id.
* Test connection warns when this server's clock is more than 2 minutes off.
* Changed: a variation is sent without the description, categories and brand it shares with its product, and Emporiqa reads them from the product, so syncs send less.
* Fix: moving a variable product to the Trash now removes its variations from Emporiqa straight away, not only at the next Sync All.
* Fix: on a page served from a full-page cache long enough for its security token to expire, the chat's first add to cart no longer fails with "Security check failed"; it is retried once with a fresh token.
* Fix: when Emporiqa is busy and asks a sync to slow down, Sync All and the WP-CLI sync wait as asked and send the same batch again, instead of failing the sync and blocking the next one for an hour.
* Fix: the chat's cart actions now refuse requests sent from another website, and a guest's cart security token is tied to that guest's own cart.
* Fix: the Mini-Cart block of block themes (such as Twenty Twenty-Five) now updates when the chat adds or removes items; it used to show the old count until the page was reloaded.
* Changed: requires WordPress 6.2, the oldest version WooCommerce 8.0 runs on. The signed-in shopper's token answer is marked no-store and private on every supported WordPress version.

= 1.1.10 =
* Changed: admin notices now point to the renamed dashboard section (Settings → Integration → Integration overview).
* Changed: the connect screen now says the chat goes live once the first full sync finishes.
* Text only. No functional changes.

= 1.1.9 =
* Fix: a full sync now finalizes only when every batch succeeds, so a failed batch can no longer drop items still present in your store from the chat's index. Nothing in your WooCommerce store was ever modified.
* Fix: variable products with parent-managed stock no longer over-report quantity, and decimal quantities are no longer truncated in the cart.

= 1.1.8 =
* Fix: variable products whose only sellable variations are on backorder are no longer reported as out of stock. The parent now aggregates availability with a three-state ladder (available, then backorder, then out of stock), matching the per-variation availability event so the chat never refuses a sellable variable product.
* Fix: grouped products whose child items are all out of stock now report their real lowest price instead of 0. Price is derived from all children, not just in-stock ones.
* Fix: a variable product's parent now reports the lowest variation price as its headline "from" price (was an arbitrary variation). The full low-to-high range is shown by Emporiqa from the variation data.
* Changed: removed three payload fields that the Emporiqa server does not use (`price_min`, `price_max`, `prices_include_tax`). The price range is derived from variations server-side; no merchant-visible change.

= 1.1.7 =
* New: maximum order quantity per product is now sent to Emporiqa. "Sold individually" (limit purchases to 1 per order) and the maximum from WooCommerce's Min/Max Quantities extension are respected, so the chat won't offer to add more than allowed and the merchant's cart no longer silently rejects an over-the-limit add. Customizable via the new `emporiqa_max_order_quantity` filter.
* New: products are flagged as digital/virtual so the chat answers "do you ship this?" correctly, and an availability-for-order flag lets the chat avoid trying to cart display-only products. Optional product condition (new / used / refurbished) can be supplied via the `emporiqa_product_condition` filter.
* Changed: dropped the unused `backorders_allowed` field from the payload (backorder availability is already conveyed by the availability status).
* Fix: right after a stock change the availability could be reported wrong: a just-sold-out product still shown as available (then rejected at the cart), or a just-restocked product still shown as out of stock. For stock-managed products availability is now derived from the tracked quantity, which is already correct at save time, instead of WooCommerce's stock-status label, which it updates a beat later. Most visible on variations.
* Fix: when a variable product whose variations share parent-level stock goes out of stock, each variation's availability is now updated too. Previously only the parent was, so the chat could keep offering a sold-out variation.
* No action required after upgrading.

= 1.1.6 =
* New: stock and availability changes now sync instantly on their own, without re-sending the whole product. When an order is placed, a product sells out, or you restock, Emporiqa receives a small availability update right away, so the chat never recommends something that just went out of stock, and comes back as soon as it returns.
* Covers manual stock edits, order placement, cancellations and refunds, and updates made through the REST API or WP-CLI.
* No action required after upgrading.

= 1.1.5 =
* New: minimum order quantity per product is now sent to Emporiqa. The chat will respect the minimum order quantity when recommending products or building carts, so "add 1 unit" no longer fails silently on products that require a higher minimum (e.g. wholesale, bulk, or pack-of-N items). Reads the `_minimum_allowed_quantity` post meta used by WooCommerce's official Min/Max Quantities extension and popular free clones. Stores using a different plugin can plug in their own source via the new `emporiqa_min_order_quantity` filter.
* No action required after upgrading. Default minimum stays at 1 for products with no constraint.

= 1.1.4 =
* Compatibility: clarified TranslatePress is not supported. The previous releases only read the language list from TranslatePress and never translated content. Removed the misleading detection so the listed compatibility (WPML, Polylang) reflects what actually ships.
* Reliability: added a defensive hook for WPML's `wpml_translation_update` action so translations created in the Block Editor are re-dispatched once WPML finishes linking them. Same shape of safety net the 1.1.3 release added for Polylang.
* No action required after upgrading.

= 1.1.3 =
* Fix: Polylang translations created in the Block Editor no longer leak into Emporiqa as a separate page in the wrong language. The plugin now waits for Polylang to finish linking the translation before sending.
* Fix: clearer error messages on the Sync and Test Connection screens. Instead of "Unexpected status code: 401" you now see the actual reason from Emporiqa (e.g. invalid signature, rate limit, validation error).
* Reliability: tighter timeouts on background webhook sends so a slow Emporiqa response can't tie up the Action Scheduler queue. Failed sends keep retrying with exponential backoff (60s, 4min, 16min).
* Reliability: queued webhook payloads now survive up to 24 hours in case the WordPress scheduled-action runner is temporarily delayed.
* No action required after upgrading.

= 1.1.2 =
* One-click connect: link the store with a single button (no Store ID or Connection Secret to copy across tabs). Manual paste is still available on the settings page for sites without HTTPS.
* New post-connect welcome card on the Sync tab: one click to send your catalog. The chat widget goes live once the first full sync finishes.
* Reconnect rotates the connection secret automatically.
* Settings panel rewritten in plain language for store owners. Advanced section explains what each option does, in store-owner terms.
* Test Connection shows a clean "Connection successful" message on success. Errors keep the dry-run details for debugging.
* Reliability: product, page, and order updates are sent to Emporiqa in the background. Your admin and checkout pages don't wait on the connection, even if Emporiqa is slow to respond.
* Tested with WordPress 7.0.

= 1.1.1 =
* Parent product SKU now uses the WooCommerce SKU field when set, so customers who type a real SKU find the right product. Re-sync after upgrading.

= 1.1.0 =
* Simplified settings page: Connection Settings is the only section expanded by default
* Order Tracking API URL moved into Connection Settings for easier setup
* Order tracking endpoint is now always registered. It stays protected by HMAC-SHA256 signature verification, a 5-minute timestamp tolerance, and per-IP rate limiting
* Email verification for order tracking is now always required (no longer toggleable)
* Test Connection button and WP-CLI command reference moved to the Sync tab (CLI reference collapsed by default)
* Sync Settings (sync scope, languages, page post types) moved below Advanced and collapsed by default

= 1.0.0 =
* Initial release
* Product and variation synchronization via webhooks
* Simple, variable, grouped, and external product types supported
* Page synchronization for configurable post types
* Multi-language support (Polylang, WPML, WordPress locale)
* Multi-currency support (WOOCS, WPML Multi-Currency, WC Payments, Aelia)
* Embedded chat widget with automatic language and currency detection
* In-chat cart operations with stock and purchasability validation
* Conversion tracking via order completion webhooks (filterable statuses)
* Order tracking REST API with HMAC authentication and rate limiting
* Webhook retry with exponential backoff via Action Scheduler
* Tax-inclusive/exclusive pricing context in product payloads
* Variable product price ranges (min/max)
* Stock reduction re-sync on order placement
* WP-CLI commands for bulk sync operations
* Event deduplication for batch operations
* WordPress filters for data customization

