=== Togglix Variation Switcher for WooCommerce ===
Contributors: karthickmurugan
Tags: woocommerce, variation, cart, checkout, blocks
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Let customers edit variable product attributes directly from WooCommerce Cart and Checkout pages.

== Description ==

Togglix Variation Switcher for WooCommerce helps customers update selected variation attributes (size, color, material, etc.) without leaving the purchase flow.

Instead of removing a variable product and searching again on the product page, the customer can click **Edit** next to the line item, choose another valid combination, and update the existing cart line with AJAX.

The plugin supports both block-based (WooCommerce Blocks) and classic Cart/Checkout experiences, includes runtime compatibility controls, and adds analytics to monitor usage and outcomes.

= Key Features =

* Edit variable products directly from Cart and Checkout
* Works with both WooCommerce Blocks and classic templates
* Cart-line-aware updates using cart item keys (better accuracy when similar products exist in cart)
* Optional variation preview panel (price, SKU, stock, image)
* Inventory-aware switching (only purchasable combinations)
* Per-product overrides (disable switcher or custom Edit label)
* Rules engine (roles, coupon state, include/exclude products/categories/tags)
* Compatibility profiles + Safe mode for conflict handling
* Analytics with date range, conversion rate, failed reason breakdown, chart, top products, and CSV export
* Translation-ready (`languages/togglix-variation-switcher-for-woocommerce.pot`)

= Settings Overview =

After activation, go to: **WooCommerce -> Variation Switcher**

== General ==
* Enable plugin
* Update button label
* Edit link label

== Design ==
* Popup width (320-1200)
* Primary color (WordPress color picker)

== Behavior ==
* Variation preview on/off
* Show close button
* Close on overlay click
* Auto reload delay (ms)
* Inventory-aware switching

== Compatibility ==
* Compatibility profile (Auto, Classic-first, Blocks-first, Safe)
* Enable on Cart page
* Enable on Checkout page
* Use partial refresh after update
* Safe mode (fallback)
* WooCommerce Blocks integration toggle
* Diagnostics report with copy-to-clipboard helper

== Rules ==
* Disable when coupon applied
* Allowed user roles
* Include/Exclude products (searchable)
* Include/Exclude categories (select2)
* Include/Exclude tags (select2)

== Analytics ==
* Date range filter
* Summary metrics (opens, success, failed, conversion rate)
* Failed updates by reason
* Daily activity mini chart
* Top products in range
* CSV export

= Per-product options =

For variable products, in Product data (General tab):

* Disable variation switcher for this product
* Custom Edit label for this product

= Compatibility =

* WordPress: 6.0+
* WooCommerce: required
* PHP: 7.4+
* HPOS compatible (declared)
* Supports WooCommerce Blocks and classic Cart/Checkout templates

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`, or install it from the WordPress Plugins screen.
2. Activate the plugin through the `Plugins` menu in WordPress.
3. Ensure WooCommerce is installed and active.
4. Open **WooCommerce -> Variation Switcher** to configure behavior.

== How to Use ==

1. Add a variable product to the cart.
2. Go to Cart or Checkout.
3. Click the **Edit** link on a variation line item.
4. Select new attribute values in the popup.
5. Click **Update**.
6. Totals and line details refresh (partial refresh or full reload based on settings).

== Frequently Asked Questions ==

= Does this work without WooCommerce? =

No. WooCommerce must be active.

= Does this support simple products? =

No. It is designed for variable products.

= Does it support WooCommerce Cart/Checkout Blocks? =

Yes. Enable/disable this behavior in Compatibility settings.

= Does it support classic Cart/Checkout templates? =

Yes. The plugin includes a classic filter-based fallback.

= Does it work for guest users? =

Yes. AJAX endpoints are registered for both authenticated and non-authenticated users.

= Does it keep quantity when changing a variation? =

Yes. The original quantity is preserved when switching.

= Can I restrict which products can be edited? =

Yes. Use include/exclude controls for products, categories, and tags in the Rules tab.

= Can I export analytics data? =

Yes. Use the Analytics tab and click **Export CSV**.

== Screenshots ==

1. Edit link for variable products in Cart
2. Edit link for variable products in Checkout
3. Variation selector popup with optional preview
4. Rules tab (include/exclude controls)
5. Compatibility tab (profiles, safe mode, diagnostics)
6. Analytics tab (metrics, chart, export)

== Changelog ==

= 1.1.0 =
* Added modular settings UI with tabs (General, Design, Behavior, Compatibility, Rules, Analytics).
* Added variation preview toggle and improved popup controls.
* Added partial refresh/full reload control after update.
* Added compatibility profile modes and safe mode fallback.
* Added product/category/tag include/exclude rules and role/coupon restrictions.
* Added per-product controls (disable switcher, custom Edit label).
* Added analytics storage, date filtering, conversion metric, failed reason report, chart, and CSV export.
* Added admin enhancements (color picker, searchable selectors, diagnostics report copy tool).

= 1.0 =
* Initial public release.

== Upgrade Notice ==

= 1.1.0 =
Recommended update for advanced controls, compatibility tools, and analytics.
