=== Katalog Visibility for WooCommerce ===
Contributors: shabtech
Tags: woocommerce, product visibility, shop page, hide categories, product categories
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
Requires Plugins: woocommerce
WC requires at least: 6.0
WC tested up to: 9.6
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Hide selected product categories from the Shop page while keeping them visible on category pages.

== Description ==

**Katalog Visibility for WooCommerce** gives store owners granular control over which product categories appear on the main Shop page — without affecting visibility anywhere else on the site.

Products in hidden categories remain fully accessible through:

* Their own category archive pages (e.g. `/product-category/wholesale/`)
* Direct product URLs
* Search results (configurable)
* Cart, checkout, and all other WooCommerce pages

= Use Cases =

* **Wholesale / trade-only products** — keep them off the public Shop page but accessible via direct links shared with trade customers.
* **Coming soon collections** — prepare categories ahead of launch without exposing them to casual shoppers.
* **Funnel-based selling** — drive traffic to specific landing/category pages instead of the Shop page.
* **Members-only products** — pair with the developer filter to show/hide categories based on user role.

= Features =

* **Multi-select category picker** — searchable Select2 dropdown listing all product categories including nested subcategories.
* **Selective hiding** — only the main Shop page is affected; category archives always show all their products.
* **Optional search exclusion** — toggle to also hide selected categories from frontend search results.
* **Optional tag archive exclusion** — toggle to also hide selected categories from product tag archive pages.
* **Per-product override** — "Force show on Shop page" checkbox on individual products to override category-level hiding.
* **Debug logging** — enable debug mode to log excluded category and product IDs to WooCommerce Status Logs.
* **Developer-friendly** — `wsvc_hidden_categories` filter allows programmatic control (e.g. role-based visibility).
* **Safe query merging** — appends to existing `tax_query` without overriding other plugins' filters.
* **HPOS compatible** — fully compatible with WooCommerce High-Performance Order Storage.
* **Lightweight** — no external dependencies, no custom database tables, no frontend assets.

= Developer Filter Example =

Show hidden categories to wholesale users:

`add_filter( 'wsvc_hidden_categories', function ( $hidden ) {
    if ( current_user_can( 'wholesale_customer' ) ) {
        $wholesale = get_term_by( 'slug', 'wholesale', 'product_cat' );
        if ( $wholesale ) {
            $hidden = array_diff( $hidden, array( $wholesale->term_id ) );
        }
    }
    return $hidden;
} );`

== Installation ==

1. Download the plugin zip file.
2. In your WordPress admin, go to **Plugins → Add New → Upload Plugin**.
3. Upload the zip file and click **Install Now**.
4. Activate the plugin.
5. Navigate to **WooCommerce → Settings → Products → Katalog Visibility**.
6. Select the categories you want to hide from the Shop page and save.

Alternatively, upload the extracted `katalog-visibility-for-woocommerce` folder to `/wp-content/plugins/` via FTP and activate from the Plugins screen.

== Frequently Asked Questions ==

= Will hidden products still appear on their category pages? =
Yes. Hiding only applies to the main Shop page. Category archive pages always display all their products normally.

= Can I still link directly to a hidden product? =
Yes. Direct product URLs are never affected. Hidden products remain fully accessible via their permalink.

= Does this affect the admin dashboard or WooCommerce REST API? =
No. Filtering only applies to frontend WooCommerce product queries. Admin, REST API, cart, and checkout are never modified.

= Can I hide products from search results too? =
Yes. Enable the "Also hide from search results" toggle in the settings.

= Can I override hiding for a specific product? =
Yes. Edit the product and check the "Shop Visibility Override" checkbox under the General tab. That product will appear on the Shop page even if its category is hidden.

= Is this compatible with WooCommerce HPOS? =
Yes. The plugin declares full compatibility with High-Performance Order Storage.

= Does this work with other plugins that modify product queries? =
Yes. The plugin safely merges its exclusion into the existing tax_query rather than replacing it, so other plugins' query modifications are preserved.

== Screenshots ==

1. Settings page — multi-select category picker with toggles for search and tag archive exclusion.
2. Per-product override checkbox in the product editor General tab.

== Changelog ==

= 1.0.0 =
* Initial release.
* Multi-select category hiding from Shop page.
* Optional search result exclusion.
* Optional product tag archive exclusion.
* Per-product "Force show on Shop page" override.
* Debug logging to WooCommerce Status Logs.
* `wsvc_hidden_categories` developer filter.
* HPOS compatibility declared.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
