=== CodersShip AI Chatbot for WooCommerce ===
Contributors: shahidifraheem, codersship
Tags: woocommerce, ai chatbot, product availability, lead capture, customer support
Requires at least: 6.0
Tested up to: 7.0
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

An intelligent AI chatbot for WooCommerce stores. Answers product availability, handles FAQs, captures leads, and improves customer engagement.

== Description ==

CodersShip AI Chatbot for WooCommerce brings an AI-powered assistant to your WooCommerce store. It helps customers check product stock in real time, answers custom FAQs, captures leads, and reduces support tickets.

**Key Features:**

✅ **Product Availability Check** – Customers can ask "Do you have Laptop?" and get instant stock updates.
✅ **Real‑time WooCommerce Integration** – Automatically reads product names, stock, and categories.
✅ **Custom FAQ Patterns** – Define regex‑based questions and answers via admin panel.
✅ **Lead Capture** – Collect visitor name/email before starting a chat (optional).
✅ **REST API Endpoint** – `/cschatwc/v1/chat` for external or headless integrations.
✅ **Shortcode Ready** – Use `[cschatwc_chatbot]` anywhere (page, post, widget).
✅ **Global Toggle** – Option to display chatbot on all pages or only via shortcode.
✅ **Synonyms** – Map slang to canonical product names (e.g., "macbook" → "Laptop").
✅ **Custom Product Lists** – For stores not using WooCommerce, define your own products with stock.
✅ **Fully Translation Ready** – All strings use proper text domain.

**Admin Features:**

- Settings page to control lead capture, product source, synonyms, and global enable.
- Manage custom FAQs (add, edit, delete) with regex patterns.
- View captured leads with name, email, timestamp, and page URL.
- Promotional sidebar to cross‑sell your other products.

**Technical Highlights:**

- Follows WordPress Coding Standards (escaping, nonces, sanitization, capabilities).
- Direct file access protection on all PHP files.
- Safe output escaping and translation functions.
- `wp_safe_redirect()` and permission checks for admin actions.

**Demo & Support**

- Visit [Coders Ship](https://codersship.com/) for documentation and support.

== Installation ==

1. Upload the `codersship-ai-chatbot-woocommerce` folder to `/wp-content/plugins/`.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **CS Chat** in the admin menu.
4. Configure settings:
   - Enable/disable lead capture.
   - Choose product source (WooCommerce or custom list).
   - Add custom FAQs and synonyms.
5. Insert the shortcode `[cschatwc_chatbot]` into any post, page, or widget.
6. (Optional) Enable "Global Enable" to show the chatbot on all pages.

== Frequently Asked Questions ==

= How do I change the chatbot's appearance? =

The plugin includes basic inline CSS. You can override styles using your theme's CSS or via the `wp_head` action.

= Can I use this without WooCommerce? =

Yes. In Settings → Product Source, select "Custom List" and define your products (one per line: `Name|Stock`).

= How to capture leads? =

Enable "Lead Capture" in Settings. The chatbot will ask for name/email before answering questions. Leads are stored under **Captured Leads** submenu.

= Can I add my own FAQ answers? =

Absolutely. Go to CS Chat → Settings → Custom FAQ Answers. Enter a regex pattern (e.g., `\b(return|refund)\b`) and your answer.

= Does it support translations? =

Yes. The plugin uses `__()`, `_e()`, `esc_html__()`, etc. with text domain `codersship-ai-chatbot-woocommerce`. You can translate with Loco Translate or WordPress.org translation tools.

= How does the synonym feature work? =

For example, if you set `macbook|Laptop`, when a user types "macbook", the chatbot will treat it as "Laptop" and check stock for that product.

= Is the REST API public? =

The endpoint `/cschatwc/v1/chat` is publicly accessible (no authentication). It accepts POST JSON `{ "message": "Do you have Laptop?" }` and returns a reply. Lead capture is also sent via `{ "lead": { "name": "John", "email": "john@example.com" } }`.

== Screenshots ==

1. Chatbot widget on front-end.
2. Admin settings page – SM Chat.
3. Custom FAQ management.
4. Captured leads table.

== Changelog ==

= 1.0.0 =
* Initial release.
* WooCommerce product availability check.
* Custom FAQ with regex patterns.
* Lead capture and storage.
* REST API endpoint.
* Shortcode and global display options.
* Synonyms and custom product lists.
* Fully WPCS compliant with escaping and sanitization.