=== Conditional Category Attributes for Vendors ===
Contributors: LogicBlue
Donate link: https://techtubo.com/
Tags: woocommerce, attributes, categories, vendors, marketplace
Requires at least: 5.0
Tested up to: 7.0
Requires PHP: 7.2
Requires Plugins: woocommerce
Stable tag: 2.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Restrict WooCommerce product attributes based on product categories for multi-vendor marketplaces.

== Description ==

**Conditional Category Attributes for Vendors** gives marketplace admins full control over which global product attributes vendors can use, based on the product categories they select.

When a vendor picks a category, the attribute dropdown is automatically filtered to show only the attributes you have allowed for that category. This keeps your product data clean, consistent, and free from irrelevant or misused attributes.

= Perfect For =
* Multi-vendor marketplaces using **Dokan**, **WCFM**, or similar vendor dashboards
* Stores with large attribute catalogs that need category-level organization
* Admins who want to prevent vendors from adding unrelated specifications

= Key Features =
* **Category-Based Attribute Mapping** – Assign allowed global attributes directly from the Product Category screen
* **Inheritance Support** – Child categories automatically inherit allowed attributes from parent categories
* **Visual Modal Selector** – Clean popup interface with live search and inline chip display
* **Frontend Dropdown Filtering** – Automatically filters the vendor attribute dropdown in real time as categories are selected
* **Backend Hard Validation** – Strips disallowed attributes on save, even if a vendor bypasses the frontend
* **Sidebar Widget Optimization** – Frontend shop sidebar only shows attributes relevant to the current category
* **Stale Data Cleanup** – Automatically removes previously selected attributes that become invalid after a category change
* **Vendor Request Attribute** – Built-in foundation for vendors to request new attributes (Pro)

= Pro Version =
Unlock advanced tools including bulk category mapping, attribute health scanner, advanced vendor request workflows, and priority support.

[Upgrade to Pro](https://techtubo.com/)

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/vendor-cond-attrs`, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Make sure **WooCommerce** is active.
4. Navigate to **Products > Categories** and edit any category to configure allowed attributes.

== Frequently Asked Questions ==

= Does this work with Dokan? =
Yes. The plugin is built with first-class support for Dokan vendor dashboards and hooks into Dokan's product add/edit screens.

= Does this work with WCFM or other vendor plugins? =
The Lite version is optimized for Dokan. Pro includes extended compatibility for WCFM and other major multi-vendor solutions.

= What happens if a vendor tries to save a disallowed attribute? =
The backend validation layer automatically removes any global attribute (pa_*) that is not permitted for the selected categories before the product is saved.

= Are custom attributes affected? =
No. Custom attributes (non-prefixed) are always preserved. Only global WooCommerce attributes (pa_*) are restricted.

= Do child categories inherit parent restrictions? =
Yes. If a child category has no explicit mapping, it will inherit the allowed attributes from its nearest ancestor that has one.

= Can vendors request new attributes? =
The Lite version includes the foundational code. The full vendor request workflow is available in the Pro version.

== Screenshots ==

1. Category edit page showing mapped attributes for the Fashion category
2. Inline chip display showing selected allowed attributes on the category screen
3. Visual modal selector with search filter for choosing allowed attributes
4. Real-time attribute dropdown filtering in the vendor dashboard
5. Vendor attribute request feature with request history and status tracking

== Changelog ==

= 2.0.1 =
* Refactored codebase into standard WordPress folder structure
* Separated CSS, JS, and HTML views into dedicated asset folders
* Improved asset loading with conditional admin/frontend enqueue
* Added index.php security files to all subdirectories

= 2.0.2 =
* Enhanced stale data cleanup for previously selected attributes
* Added click-outside modal close functionality
* Improved search filter performance in attribute modal

= 2.0.1 =
* Fixed inheritance logic for nested category trees
* Added backend hard validation on product save

= 2.0.0 =
* Initial release with category attribute mapping
* Dokan vendor dashboard integration
* Frontend sidebar widget optimization

== Upgrade Notice ==

= 2.0.1 =
Maintenance release with improved code organization and asset handling. Recommended for all users.