=== Storzen Product Tag Assistant for WooCommerce ===
Contributors:      devhasib,webtendhq
Tags:              woocommerce, product tags, auto tags, ai, openai
Requires at least: 6.7
Tested up to:      7.1
Requires PHP:      8.1
Requires Plugins:  woocommerce
Stable tag:        1.0.2
WC requires at least: 8.0
WC tested up to:   9.9
License:           GPLv2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

Auto-tag WooCommerce products with free rules (no API key) or optional AI: OpenAI, Claude, Gemini, DeepSeek. Bulk and background tagging.

== Description ==

**Storzen Product Tag Assistant for WooCommerce** adds product tags to your WooCommerce store automatically. Choose the way that suits you:

* **Rules mode (free, no API key):** create simple rules such as "if the title or description contains *leather*, add the tag *Leather*" or "if the category is *Shoes*, add the tag *Footwear*". Everything runs on your own site, so no product data is sent anywhere.
* **AI mode (optional):** connect your own OpenAI, Anthropic (Claude), Google Gemini or DeepSeek account and get suggested product tags, categories and attributes that you can review before anything is saved.

📖 [View Documentation](https://webtend.net/docs/product-tag-assistant-doc.html) | 🌐 [WebTend](https://webtend.net/)


Either way, you can tag one product at a time, tag products in bulk from the products list, apply tags automatically when a product is saved, tag **new and imported products automatically** (CSV importer, REST API, WP All Import and other plugins), or tag your whole catalog in the background with a live progress bar.

Well-organised product tags make your store easier to browse and search, help shoppers find related products, and can give search engines clearer signals about what you sell. Adding tags by hand to hundreds of products takes hours. This plugin does the first pass for you, and you stay in control of the result.

= Why use it? =

* **Save hours of manual work.** Stop typing tags and sorting products one by one.
* **Keep tags consistent.** The same style of tag across your whole catalog.
* **Start free, no account needed.** Rules mode works right after activation.
* **Stay in control.** Preview every suggestion and deselect anything you don't want before applying.
* **Use what you already have.** Tags come from your existing titles, descriptions, categories and attributes.

= Common ways to use it =

* Add product tags automatically by keyword, such as material, brand, style or occasion
* Tag WooCommerce products by category or by attribute value (for example every product with Material: Cotton)
* Turn attributes such as Brand or Material directly into product tags
* Automatically tag new products created by the WooCommerce CSV importer, the REST API or other plugins
* Bulk add product tags to an existing store, or to products you already imported
* Find untagged products and tag them all in one background job
* Get AI-suggested product tags, categories and attributes with OpenAI, Claude, Gemini or DeepSeek

= Key features =

* **Rules mode, free, no API key:** tag products when their title or description contains keywords, when they are in a category, or when they have an attribute value
* Turn product attributes such as Material or Brand into tags
* Rules only add tags; the tags a product already has are kept
* Optional AI mode: suggestions for tags, categories and attributes using your own OpenAI, Anthropic (Claude), Google Gemini or DeepSeek key
* Review screen with clickable suggestions — select or deselect before applying
* Optional auto-tagging when a product is saved
* **Tag new products from any source:** products created by importers, the REST API and other plugins are queued and tagged in the background, without slowing the import down
* Bulk auto-tag products from the WooCommerce products list
* Tag your whole catalog in the background with a live progress bar — pause, resume or cancel any time
* "Untagged" filter on the products list to find products with no tags
* Works with simple, variable, grouped and external products
* AI mode: pick a provider and model: OpenAI (GPT-4o Mini, GPT-4o), Anthropic (Claude Haiku 4.5, Sonnet 5.5), Google Gemini (3.1 Flash-Lite, 3.5 Flash) or DeepSeek (Flash, V4 Pro)
* Set how many tags to create per product
* AI mode: custom prompt option for advanced users
* Activity log table and WooCommerce log integration for troubleshooting
* Compatible with High-Performance Order Storage (HPOS)
* Loads its scripts and styles only on the screens that need them
* Translation-ready, with GDPR privacy-policy and data hooks

= How it works =

1. Install and activate the plugin. It starts in **Rules** mode, so there is nothing to connect.
2. Go to **WooCommerce → Settings → Tag Assistant** and add one or more rules.
3. Open any product and click **Preview Matching Tags** in the Tag Assistant panel, then **Apply Selected**. Or enable auto-tagging on save, switch on **Tag new products from any source** for imports, or run the whole catalog in the background.

Want AI suggestions instead? Choose **AI** as the mode, pick a provider, add your own API key and click **Get AI Suggestions** on any product.

To tag many products at once, select them in the products list and choose a Tag Assistant bulk action. To tag a whole store, open **Catalog Tagging** on the settings tab and start a background job; it keeps running even if you close the page.

= Who is it for? =

* Store owners with large or growing catalogs who want tidy, consistent product tags
* Agencies and freelancers who set up or clean up WooCommerce stores for clients
* Anyone who wants a faster way to organise products without a manual tagging workflow

= Requirements =

* WooCommerce (installed and active)
* Rules mode needs nothing else. AI mode needs your own API key from OpenAI, Anthropic, Google or DeepSeek; the provider bills you directly for usage.

= External services =

In **Rules** mode (the default for new installs) this plugin does not connect to any external service and sends no data anywhere.

In **AI** mode only, this plugin connects to the one AI provider you choose in the settings, to generate tag, category and attribute suggestions. Nothing is sent to the other two. It is used only when you have chosen AI mode, picked a provider, entered your own API key, and you click **Get AI Suggestions** or **Test API Connection**, run a bulk action, start a catalog job, or enable auto-tagging on product save or for new products. Nothing is sent when the plugin is activated.

Data sent: the product title, short description, an excerpt of the description, SKU and existing category names, plus the tagging instructions. No customer, order or personal data is sent. The "Test API Connection" button sends a one-word test message.

**OpenAI** - endpoint `https://api.openai.com/v1/chat/completions`. [Terms of use](https://openai.com/policies/terms-of-use) | [Privacy policy](https://openai.com/policies/privacy-policy).

**Anthropic (Claude)** - endpoint `https://api.anthropic.com/v1/messages`. [Commercial terms](https://www.anthropic.com/legal/commercial-terms) | [Privacy policy](https://www.anthropic.com/legal/privacy).

**Google Gemini API** - endpoint `https://generativelanguage.googleapis.com/v1beta/models/`. [Terms](https://ai.google.dev/gemini-api/terms) | [Privacy policy](https://policies.google.com/privacy).

**DeepSeek API** - endpoint `https://api.deepseek.com/chat/completions`. [Open Platform terms](https://cdn.deepseek.com/policies/en-US/deepseek-open-platform-terms-of-service.html) | [Privacy policy](https://cdn.deepseek.com/policies/en-US/deepseek-privacy-policy.html). DeepSeek's privacy policy says data is processed and stored in China, so please review it before choosing this provider.

= Privacy =

In Rules mode no data leaves your site. In AI mode this plugin sends product information (see "External services" above) to the provider you chose for processing. No customer names, email addresses or order data are transmitted. Please review that provider's privacy policy before using AI mode.

== Installation ==

1. Make sure WooCommerce is installed and active.
2. Upload the plugin folder to `/wp-content/plugins/`, or install it via **Plugins → Add New**.
3. Activate the plugin.
4. Go to **WooCommerce → Settings → Tag Assistant** and add your first rule. No API key is needed.
5. Open any product and use the **Tag Assistant** panel in the sidebar.
6. Optional: switch to AI mode, choose a provider, enter your API key and click **Test API Connection**.

== Frequently Asked Questions ==

= How do I automatically add tags to WooCommerce products? =

Add one or more rules under **WooCommerce → Settings → Tag Assistant**, then either click **Preview Matching Tags** on a product, enable auto-tagging on save, or use a bulk action on the products list. No API key is required. If you prefer AI, switch the mode to AI, choose OpenAI, Anthropic, Gemini or DeepSeek and add your own API key.

= Can I bulk add product tags in WooCommerce? =

Yes. Select several products in the products list, then choose one of the Tag Assistant bulk actions. You can preview suggestions only, or tag and apply them straight away. In AI mode large batches take a little longer because the plugin pauses briefly between products to avoid hammering the API.

= Do I need an API key? =

No. Rules mode works without any API key and without any account. An API key is only needed if you choose the optional AI mode. The plugin does not include AI credits: you add your own key from OpenAI, Anthropic, Google or DeepSeek, and the provider bills you directly for usage. The default model of each provider is its fast, low-cost one.

= Is there a free WooCommerce auto tag plugin that needs no API key? =

Yes. Rules mode is free and needs no API key, no account and no external service. You write simple rules, and the plugin adds the matching tags to your products. You can switch to the optional AI mode at any time.

= How do I tag WooCommerce products by category or by attribute? =

Open **WooCommerce → Settings → Tag Assistant**, add a rule, and choose **If category is** or **If attribute is**. Pick the category (sub-categories are included) or type the attribute name and, if you like, a value, then enter the tags to add. You can also pick attributes such as Material or Brand to turn their values straight into tags.

= Does it work with OpenAI, Claude, Gemini and DeepSeek? =

Yes. In AI mode you choose one provider (OpenAI, Anthropic Claude, Google Gemini or DeepSeek), add your own API key and pick a model. Only the provider you choose receives data, and only when you trigger a request.

= What kind of rules can I create? =

Three kinds: text rules (the title or description contains one or more keywords, either anywhere or as a whole word), category rules (the product is in a category, including its sub-categories) and attribute rules (the product has an attribute, optionally with a certain value). Each rule adds one or more tags. You can also turn the values of chosen attributes, such as Material or Brand, directly into tags.

= Can I use another AI provider? =

AI mode ships with OpenAI, Anthropic (Claude), Google Gemini and DeepSeek. Developers can register more through the `aptwc_ai_providers` filter by implementing the `Provider_Interface` class, and can update a provider's model list with the `aptwc_provider_models` filter.

= Does rules mode send my product data anywhere? =

No. Rules run entirely on your server.

= Which AI model should I use? =

Each provider's fast, low-cost model is selected by default (GPT-4o Mini, Claude Haiku 4.5, Gemini 3.1 Flash-Lite, DeepSeek Flash) and works well for most catalogs. The larger model of each provider is there if you want higher accuracy on complex product data.

= Will it overwrite my existing product tags? =

In Rules mode, tags are only ever added; the tags a product already has are kept. In AI mode, applied suggestions replace the product's current tags, while categories are added to what the product already has and existing categories are never removed. In the product panel you can review and deselect any suggestion before applying. If you enable auto-tagging on save, suggestions are applied without a review step, so test on a few products first.

= Can I tag my entire catalog at once? =

Yes. Go to **WooCommerce → Settings → Tag Assistant → Catalog Tagging** and click **Tag untagged products** (or **Re-tag all products**). The job runs in the background using Action Scheduler, which is included with WooCommerce, so large catalogs do not hit PHP time limits. A progress bar shows how far it has got, and you can pause, resume or cancel at any time. In Rules mode the job runs locally and quickly, and products that match no rule are left unchanged and counted as "No match". In AI mode, if the API key is wrong or the service keeps failing, the job stops by itself after repeated errors, and if the provider rate-limits the plugin it waits and retries.

= How do I automatically tag imported products? =

Go to **WooCommerce → Settings → Tag Assistant** and switch on **Tag new products from any source**. Every product created by the WooCommerce CSV importer, the REST API, WP All Import or another plugin is queued and tagged in the background about 30 seconds after it is created, so the import itself stays fast and the product's categories and attributes are already saved. Products created in the product editor are covered by **Auto-tag on save**. This needs Action Scheduler, which is included with WooCommerce.

= Will it overwrite the tags that are in my import file? =

No, not by default. **Skip new products that already have tags** is on by default, so products that arrive with tags are left alone. Turn it off only if you want the plugin to tag those products too (in AI mode, applied tags replace the existing ones).

= How do I find products that have no tags? =

On **Products → All Products** click the **Untagged** link above the table.

= Does it work with variable, grouped and external products? =

Yes, it works with all WooCommerce product types.

= Is my product data sent anywhere other than my chosen AI provider? =

No. In AI mode only the product details listed under "External services" are sent to the one provider you chose, and in Rules mode nothing is sent at all. The plugin does not contact any other third-party service.

= Will it slow down my store? =

No front-end scripts or styles are added to your shop pages. The plugin's assets load only on the product edit screen and on its own settings tab, and rules are evaluated only when you trigger them or when auto-tagging is enabled, and in AI mode the request runs only at those moments too.

= Is it compatible with HPOS? =

Yes. The plugin declares compatibility with WooCommerce High-Performance Order Storage.

= Where can I see the plugin's activity logs? =

Go to **WooCommerce → Status → Logs** and select the `storzen-product-tag-assistant-for-woocommerce` log source.

= What happens when I uninstall the plugin? =

All plugin settings, product meta and the activity log table are permanently removed from your database. Tags and categories already applied to your products are kept.

== Screenshots ==

1. Tag Assistant panel on the product edit screen, showing suggested tags (and in AI mode categories and attributes) as selectable chips.
2. WooCommerce → Settings → Tag Assistant, with the mode picker and the tagging rules builder (no API key needed).
3. Bulk tagging actions in the WooCommerce products list.
4. Success notice after a bulk run, with the new tags and categories shown in the products list.
5. Catalog Tagging on the settings tab, with a live progress bar and pause, resume and cancel controls.
6. AI mode settings: choose OpenAI, Claude, Gemini or DeepSeek, then add your API key, pick a model and test the connection.
7. Tagging behaviour: auto-tag on save and the new "Tag new products from any source" switch for imports.

== Changelog ==

= 1.0.2 =
* New: **Tag new products from any source.** Products created by the WooCommerce CSV importer, the REST API, WP All Import or other plugins are queued and tagged in the background shortly after creation, so imports stay fast. Works in Rules and AI mode, and skips products that already have tags by default.
* New: developers can use the `aptwc_should_tag_new_product` filter to skip products and `aptwc_new_product_delay` to change the wait before tagging.
* Fixed: Catalog Tagging could wrongly report that there was nothing to tag.
* Fixed: the product panel showed an empty "Suggested Categories" heading in Rules mode, and dropdowns on the settings page lost their arrow.
* Improved: safeguards for imports. Rate limits are retried with a growing delay, and tagging pauses for a while after repeated API failures instead of retrying thousands of times.

= 1.0.1 =
* New: Rules mode. Tag products with your own rules, with no API key and no data leaving your site. Rules can match keywords in the title or description, a category (sub-categories included) or an attribute value.
* New: turn chosen product attributes (for example Material or Brand) into tags.
* New: Rules mode is the default for new installs, so the plugin works right after activation. Existing sites that already have an API key stay in AI mode.
* New: AI mode now supports Anthropic (Claude Haiku 4.5, Sonnet 5.5), Google Gemini (3.1 Flash-Lite, 3.5 Flash) and DeepSeek (Flash, V4 Pro) next to OpenAI. Pick the provider in the settings. Existing OpenAI settings keep working with no migration.
* New: developers can add AI providers with the `aptwc_ai_providers` filter and update model lists with `aptwc_provider_models`.
* New: Catalog Tagging. Tag untagged or all products in the background with a live progress bar, pause, resume and cancel (uses Action Scheduler). In Rules mode it runs in larger, faster batches and shows a "No match" counter.
* New: "Untagged" view on the products list.
* New: modern admin design with a card-based settings page, status pill, mode and model pickers, toggle switch and live job stats; cleaner product panel with selectable chips and counts. Follows your WordPress admin colour scheme.
* Fixed: auto-tag on save did not run after saving the setting from the settings page.
* Improved: applied tags reuse an existing tag with the same slug instead of creating a duplicate, and tag names typed in rules are kept as written (for example "Leather").
* Improved: the job stops automatically after repeated errors and retries after API rate limits.
* Improved: API keys, custom prompt and job state are no longer autoloaded options.
* Improved: stricter nonce handling when saving settings; removed an unneeded rewrite flush on deactivation.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.2 =
Adds optional background tagging of new and imported products (off by default). No upgrade steps required.

= 1.0.1 =
Adds a free Rules mode that needs no API key, Claude, Gemini and DeepSeek support, background catalog tagging, and fixes auto-tag on save. Sites with an existing API key stay in AI mode. No upgrade steps required.

= 1.0.0 =
Initial release. No upgrade steps required.
