=== User Exclusive Products === Contributors: aisimpleplugin Tags: products, visibility, restrict, exclusivity, private products Requires at least: 5.0 Tested up to: 7.0 WC tested up to: 10.7 Stable tag: 1.0.2 Requires PHP: 7.2 License: GPL-2.0+ License URI: https://www.gnu.org/licenses/gpl-2.0.html Restrict WooCommerce products to specific users. Products remain hidden from all unauthorized users == Description == **User Exclusive Products** lets you restrict any WooCommerce product to one or multiple users. If a product is exclusive: - Only selected users (and administrators) can see it. - Unauthorized visitors cannot see the product in shop, category, tags, search or AJAX live search. - Direct access to the product URL redirects to the shop page. - Fully compatible with modern search engines (including FiboSearch). Perfect for: - B2B stores - VIP customer access - Private product offers - Client-specific catalogs - Wholesale deals == 🔒 Key Features == - Restrict product visibility to **specific users only** - Admins are always allowed (cannot be restricted) - Product completely hidden from: - Shop - Category pages - Product tags - Search results - AJAX / live search - REST API product queries - Lightweight & fast (no bloat) - No role management required - Simple multiselect user selector (WooCommerce-style) == 🧩 Compatibility == This plugin is built with **standard WooCommerce filters**, making it compatible with most themes. **Tested and working with:** - Botiga / Botiga Pro (AJAX search compatible) - Storefront - Astra (front-end compatibility may vary) - FiboSearch (fully supported) If you use a theme or plugin with custom product queries, it should still work normally as long as they respect WordPress or WooCommerce APIs. == 🎯 No Roles. No Conditions. No Complexity. == This plugin focuses on **one thing only**: → Restrict WooCommerce products to selected users. No roles, no categories, no conditions — clean, simple, reliable. == Installation == 1. Upload the plugin files to `/wp-content/plugins/user-exclusive-products/` 2. Activate the plugin through the “Plugins” menu in WordPress 3. Edit any WooCommerce product 4. Use the **Exclusive Users** box to select which customers can view the product 5. Leave empty to make the product public == Frequently Asked Questions == = Do users need to be logged in? = Yes. Only logged-in users can be matched with the allowed list. = What happens if a non-authorized user opens the product URL? = They are automatically redirected to the shop page. = Can I restrict by role? = No. This plugin is intentionally simple and only restricts by specific users. = Can I restrict categories or variations? = Not in version 1.0.0. These features may be added later if requested. = Is it compatible with FiboSearch? = Yes, fully compatible. Hidden products never appear in AJAX search results. = Does it work with all themes? = It works with any theme that respects standard WooCommerce queries. Some custom-built themes may require compatibility tweaks. == Screenshots == 1. Product metabox: Select exclusive users 2. Hidden product behavior (not visible to guests or unauthorized users) == Changelog == = 1.0.2 = * Updated: Tested up to WordPress 7.0 = 1.0.1 = * Improved: Allowed Users field now uses AJAX search (wc-customer-search) instead of a static list, supporting sites with any number of users without performance impact. * Fixed: Renamed the `AISP_Exclusif_Products_Category_Users` class to `AISP_Exclusive_Products_Category_Users` for consistency across the codebase. * Fixed: Corrected class name casing from `AISP_exclusive_Products_*` to `AISP_Exclusive_Products_*` across multiple plugin modules. * Fixed: `AISP_Exclusive_Products_Category_Users` and `AISP_Exclusive_Products_Bulk_Actions` are now initialized only after confirming WooCommerce is active. * Fixed: Replaced the `rest_prepare_post` hook with `rest_prepare_product` and `rest_prepare_product_variation` to properly support WooCommerce product REST endpoints. * Fixed: `filter_rest_response()` now returns a proper `WP_Error` with HTTP 401/403 responses instead of `null` when restricted products are requested through the REST API. * Fixed: Added the `rest_product_query` filter alongside `rest_post_query` to properly intercept WooCommerce REST API product queries. * Fixed: Added `suppress_filters => true` to internal `get_posts()` calls to prevent recursive filter execution. * Fixed: Bulk action transient keys are now scoped per user to prevent collisions when multiple administrators use the interface simultaneously. * Added: Plugin constants for version, path, URL, and basename handling (`AISP_EP_VERSION`, `AISP_EP_PATH`, `AISP_EP_URL`, `AISP_EP_BASENAME`). * Added: Admin notice displayed when WooCommerce is not active instead of failing silently. * Added: New `uninstall.php` cleanup routine to remove plugin data, transients, and related cache entries when the plugin is deleted. = 1.0.0 = * Initial release == Upgrade Notice == = 1.0.1 = This update improves WooCommerce REST API compatibility, a complete uninstall cleanup routine. It also fixes several internal initialization and filtering issues. No action required. = 1.0.0 = First stable public release.