=== B3 Swatches ===
Contributors: blondb
Tags: woocommerce, variations, swatches, product, attributes
Requires at least: 6.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.1
WC requires at least: 6.8
WC tested up to: 10.6.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Replace WooCommerce variation dropdowns with modern color and button swatches for variable products.

== Description ==

B3 Swatches replaces WooCommerce variation dropdowns with fast, modern, and responsive swatches for variable products.

This version includes the feature set: color and button swatches, base layout and sizing controls, tooltip toggles, and per-product overrides.

= Features =

* Color swatches for attribute terms
* Button/label swatches for any attribute
* Wrap layout for swatch display
* Square swatch shape
* Underline selector style
* Swatch width and height controls
* Internal and external layout padding
* Show labels on color swatches
* Selected chip color customization
* Heading color and size controls
* Label font-size control
* Global settings UI with a live preview
* Basic tooltip support (enable/disable)
* Automatic dropdown-to-swatch replacement
* Attribute-term swatch configuration (Products > Attributes > Configure terms)
* Per-product swatch overrides for shared swatch types
* Fallback to native select when JavaScript is unavailable
* Optional uninstall cleanup when "Remove on uninstall" is enabled


Requirements:

* WordPress 6.8+
* WooCommerce 6.8+
* PHP 7.4+

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install via the Plugins screen (ZIP).
2. Activate the plugin.
3. Go to "B3 Swatches" to configure global settings.
4. Configure attribute term swatches under Products > Attributes.
5. Edit a variable product to override swatches per product when needed.

== Support ==

If you need help, please start by checking the FAQ below.

To request support, use the support channel where you installed the plugin (for example, the WordPress.org support forum or the support channel on the plugin website).

When contacting support, please include:

* WordPress version
* WooCommerce version
* Theme name
* A short list of other active plugins
* Steps to reproduce (and the product URL if possible)

Supported:

* Standard WooCommerce variation forms and templates
* Most properly-coded themes that do not replace the variation form markup
* Configuration questions (global settings, attribute terms, per-product overrides)

Not supported:

* Custom themes/builders that replace or heavily rewrite the WooCommerce variation form
* Debugging issues caused by custom code snippets that modify variation selection behavior


== Frequently Asked Questions ==

= Does it work without JavaScript? =

Yes. The original WooCommerce variation dropdowns remain in the markup as a fallback. B3 Swatches enhances the form when JavaScript is available.

= Can I override swatches per product? =

Yes. You can set global defaults, override per-attribute term (Products > Attributes > Configure terms), and override per-variable product.

= Will it work with my theme? =

B3 Swatches is designed to work with properly-coded WooCommerce themes. It hooks into the standard variation form and enhances the dropdown selects.

If your theme or builder heavily customizes variation templates, try temporarily switching to a default WooCommerce theme to confirm whether the issue is theme-specific.

= How do I set up swatches for an attribute? =

1. Go to Products > Attributes.
2. Create/edit an attribute (e.g., Color).
3. Click "Configure terms".
4. Set the swatch type and values for each term.

= My swatches aren't showing. What should I check? =

Common causes:

* The product must be a Variable product with variations.
* The attribute must be used for variations.
* A caching/minification plugin may be delaying scripts; test with caching disabled.
* Some themes replace the variation form markup; test with a default theme to confirm.

= What data does the plugin store? =

Settings are stored in the `b3_wvs_settings` WordPress option. Attribute swatch data is stored as term meta (`b3_wvs_type`, `b3_wvs_color`, etc.). Per-product overrides are stored as post meta (`_b3_wvs_overrides`). Data is kept by default when you uninstall the plugin unless you enable the "Remove on uninstall" setting.

= Does the plugin clean up after itself? =

Yes, when "Remove on uninstall" is enabled. By default the plugin keeps its data on uninstall. If you turn that setting on, deleting the plugin through the WordPress admin removes options, term meta, post meta, transients, and uploaded font files.


== Screenshots ==

1. Variation swatches displayed on a variable product page.
2. Admin settings screen for global swatch options.
3. Attribute term swatch configuration.
4. Per-product swatch overrides for variable products.

== Third Party Services ==

This plugin connects to the following external services under certain conditions:

= Freemius SDK =

This plugin uses the Freemius SDK for optional usage analytics. When a site owner opts in during onboarding, limited site and usage data may be sent to Freemius servers.

The plugin also includes `assets/freemius-pricing.css` and `assets/freemius-account.css`, which are styling companions for the Freemius SDK pricing/account screens. They are part of the Freemius integration surface and do not add swatch, cart, share, or other plugin feature logic.

* Freemius homepage: [https://freemius.com](https://freemius.com)
* Freemius Terms of Service: [https://freemius.com/terms/](https://freemius.com/terms/)
* Freemius Privacy Policy: [https://freemius.com/privacy/](https://freemius.com/privacy/)

== Source Code & Build Tools ==

This plugin includes pre-built JavaScript and CSS files in the `dist/` directory. The original source code is included in the `src/` directory. To build from source:

1. Install Node.js dependencies: `npm install`
2. Install PHP dependencies: `composer install`
3. Build for production: `npm run build`

The build process uses Vite (`vite.config.ts`) and TypeScript (`tsconfig.json`). See `package.json` for all available scripts.

== Changelog ==

= 1.0.1 =

* Improved admin polish and frontend stability across the swatch settings experience.
* Added explicit WooCommerce dependency metadata and tightened package/build handling for more reliable releases.
* Fixed custom swatch-type selectors in the product and term editors, including better global attribute editing for Button swatches.
* Fixed frontend swatch runtime regressions, including grouped-product `Select options` links being intercepted by AJAX add-to-cart handling.

= 1.0.0 =

* Initial release.
* Added the free launch feature set: color and button swatches, wrap layout, square swatches, sizing controls, basic tooltip support, attribute-term controls, and per-product overrides.

== Upgrade Notice ==

= 1.0.1 =

Maintenance release with admin polish, compatibility fixes, and Pro UI/runtime improvements.

= 1.0.0 =

Initial release.
