=== Recommendor for WooCommerce ===
Contributors: gautammenariyait
Tags: woocommerce, recommendations, related products, frequently bought together, upsell
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 6.0
WC tested up to: 8.6
Stable tag: 1.0.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.txt

Cloud-powered AI recommendation engine for WooCommerce. Generates intelligent, real-time product recommendations without slowing down your store.

== Description ==

The plugin seamlessly connects to the Recommendor for WooCommerce central SaaS API to provide five powerful features without dragging down your server performance.

### Features

1. **Similar Products**
   * **Logic:** Recommends products based on shared Categories, Tags, and Attributes using cloud-based AI mathematical scoring.
   * **Placement:** Automatically displayed at the bottom of single product pages.
   * **Caching:** Fetched in real-time from the API and cached locally to ensure lightning-fast page loads.

2. **Frequently Bought Together (FBT)**
   * **Logic:** Identifies products that are frequently purchased together in the exact same order (Amazon-style bundles). 
   * **Placement:** Displays a bundle widget with an "Add selected to cart" button on the single product page.

3. **Customers Also Bought (Customer Affinity)**
   * **Logic:** Identifies products bought by the same customer over their lifetime, even across different orders.
   * **Placement:** Automatically injected at the bottom of the Cart page, and inside Order Confirmation emails to drive repeat purchases.

4. **Trending Products**
   * **Logic:** Identifies the highest-selling products over a rolling timeframe.
   * **Placement:** Can be placed anywhere using the shortcode `[reco type="trending"]`.

5. **Smart Search Autocomplete**
   * **Logic:** Replaces the default WooCommerce search bar with a lightning-fast, AI-driven autocomplete dropdown that searches your synced catalog.

6. **AJAX Wishlist**
   * **Logic:** Allows customers (logged-in or guests) to save products to their wishlist. All wishlist data is stored securely in the central SaaS backend API, keeping your WordPress database clean.
   * **Placement:** Interactive heart buttons on single product pages and shop loop cards, an automatic WooCommerce My Account tab ("My Wishlist"), and shortcode `[reco_wishlist]`.

7. **Abandoned Cart Recovery**
   * **Logic:** Automatically captures real-time WooCommerce cart activity, totals, and guest email addresses typed at checkout. All cart data is stored and managed on the central SaaS backend API.
   * **Automated Recovery:** Sends automated emails for abandoned carts with a secure single-click recovery link (`?reco_recover_cart=TOKEN`) that instantly restores items to the user's cart and redirects to checkout.
   * **Dashboard Analytics:** Displays real-time recovery metrics (Total Abandoned, Recovered Revenue, Recovery Rate %) in your SaaS Admin Dashboard.

8. **Product FAQ**
   * **Logic:** Enables a dedicated FAQ tab on single product pages, allowing store owners to add, manage, and display product-specific Q&As. FAQ data is synchronized with the central SaaS backend.
   - **Placement:** WooCommerce product page tabs (alongside Description, Reviews).

9. **Product Reviews**
   * **Logic:** Enhances default WooCommerce reviews by collecting and managing customer reviews through the central SaaS platform, enabling advanced sentiment analysis and review-driven product recommendations.
   - **Placement:** Product reviews tab and automated post-purchase review request emails.

10. **Catalog Mode**
    * **Logic:** Transforms your WooCommerce store into a clean product catalog by hiding product prices, disabling "Add to Cart" buttons, and replacing them with a custom "Get a Quote" button and inquiry modal form.
    * **Features:** Flexible targeting scope (All Products, Selected Products, Excluded Products, Selected Categories), custom inquiry notification emails, per-product quote overrides, and option to hide Cart/Checkout pages.

### Real-Time Synchronization
Instead of heavy local CRON jobs, the plugin uses non-blocking asynchronous Webhooks to keep the central AI engine up to date.

== External Services ==

This plugin relies on the **Recommendor for WooCommerce** central SaaS API, hosted at:

  https://api.getrecommendor.com

**What the service does:**
All computationally intensive recommendation tasks (similarity scoring, affinity modelling, trending analysis, and smart search indexing) are processed on Recommendor's cloud servers so your own hosting is not burdened.

**What data is sent and when:**

1. **During onboarding (opt-in, triggered manually by the store owner):**
   * Store owner email address
   * Store URL (`site_url()`)
   * WooCommerce REST API consumer key and secret (read/write, used only for catalogue and order sync)
   * A flag indicating whether the owner has opted in to user-behaviour data collection

2. **Ongoing — product and order sync (only after onboarding is complete):**
   * Product data (IDs, names, categories, tags, attributes, prices) via WooCommerce Webhooks
   * Order data (product IDs purchased per order) via WooCommerce Webhooks
   * No personally identifiable customer data (names, addresses, payment details) is ever transmitted

3. **Ongoing — recommendation requests (only after onboarding is complete):**
   * The current product ID, cart contents, or session identifier when fetching personalised recommendations
   * Requests are authenticated with the API key issued during onboarding

4. **Ongoing — admin notices (only after onboarding is complete):**
   * A minimal GET request to retrieve the latest plugin notice from `api.getrecommendor.com/notices/latest`
   * No store or user data is transmitted in this request

**No data is ever sent before the store owner completes the onboarding wizard and explicitly connects their store.**

**Privacy Policy:** https://getrecommendor.com/privacy/
**Terms of Service:** https://getrecommendor.com/terms/

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/recommendor-for-woocommerce` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. You will be redirected to the Setup screen. Enter your email to automatically register your store and generate API keys.
4. Adjust your preferences in WooCommerce > Settings > Recommendations.

== Frequently Asked Questions ==

= Does this slow down my site? =
No. The heavy lifting is done on our cloud servers. Recommendations are fetched via API and cached locally.

= Can I customize the templates? =
Yes. You can copy the template files from the plugin's `/templates/` directory into a folder named `wc_recommendor` inside your active theme.

== Changelog ==

= 1.0.2 =
* Feature: Added visual previews and documentation screenshots inside the WooCommerce settings page for Similar Products and Frequently Bought Together.
* Feature: Added Product FAQ and Product Reviews integration, allowing seamless synchronization of Q&As and customer reviews with the central SaaS backend.
* Update: Bumped stable tag and verified compatibility up to WooCommerce 8.6 and WordPress 7.0.

= 1.0.1 =
* Security: Removed inline <script> tags; scripts now enqueued via wp_enqueue_script() and wp_add_inline_script().
* Security: Added sanitize_text_field() around wp_unslash() before wp_verify_nonce() calls.
* Privacy: Gated Reco_API::fetch_latest_notice() and display_notice() behind opt-in check — no outbound API calls before onboarding is complete.
* Docs: Added == External Services == section to readme.txt per WordPress.org guidelines.
* Cleanup: Removed bundled .po/.mo/.pot translation files; translations now served via translate.wordpress.org.
* Cleanup: Removed load_plugin_textdomain() call (no longer needed for WordPress.org-hosted plugins).
* Meta: Updated Contributors field to WordPress.org username.

= 1.0.0 =
* Initial public release on WordPress.org repository.
