=== WPC Smart Recommendations for WooCommerce ===
Contributors: wpclever
Donate link: https://wpclever.net
Tags: woocommerce, recommendations, upsell, cross-sell, related products
Requires at least: 5.9
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Smart product recommendations for WooCommerce driven by customer behavior — multiple algorithms, flexible layouts, and built-in analytics.

== Description ==

**WPC Smart Recommendations** is a product recommendation engine for WooCommerce. It analyzes customer shopping behavior — including items frequently purchased together, products viewed within the same browsing session, and customer affinities — to display tailored product recommendations across your store and help increase average order value.

= Live demo =

Visit our [live demo](https://demo.wpclever.net/wpcplant/ "live demo") here to see how this plugin works.

= Why WPC Smart Recommendations? =

* **Easy setup** — activate the plugin and it begins analyzing store data immediately while providing fallback recommendations out of the box.
* **Multi-algorithm engine** — combines co-purchase, co-view, category affinity, wishlist, and compare data to generate tailored product recommendations.
* **Multiple display surfaces** — product pages, cart, checkout, thank you page, popups, and anywhere via shortcodes or widgets.
* **Three layout options** — Grid, Carousel (CSS scroll-snap), and compact List view.
* **Performance analytics** — track impressions, clicks, add-to-carts, purchases, and revenue attributed to recommendations.
* **Priority rules engine** — boost, penalize, or exclude products based on price, stock, age, category, and more.
* **Template overridable** — all templates can be customized from your theme.

= Key Features =

* Co-purchase algorithm ("Customers who bought this also bought")
* Co-view algorithm ("Customers who viewed this also viewed")
* Category affinity fallback (popular products from the same category)
* Wishlist-based recommendations (integrates with WPC Smart Wishlist)
* Compare-based recommendations (integrates with WPC Smart Compare)
* Trending Now section with time-decay scoring
* Recently Viewed products (localStorage-based, zero server load)
* Personalized "For You" popup (once per session)
* Manual recommendations per product (drag to reorder)
* Order-based recommendations for thank you pages and emails
* Carousel / Slider layout with CSS scroll-snap (zero JS dependency)
* Grid layout using WooCommerce product cards
* Compact List layout for sidebars and popups
* Configurable number of columns (2-6) for Grid and Carousel
* Smart product link behavior (same tab, new tab, or Quick View popup)
* Social proof badges ("🔥 12 people bought this today")
* Exclude out-of-stock and unpurchasable products
* Exclude recently purchased products (configurable timeframe)
* Exclude specific product types
* Exclude specific pages
* Priority rules with drag-to-reorder
* Background performance tracking (impressions, clicks, add-to-carts, purchases, revenue)
* Transient-based caching with configurable TTL
* Configurable behavior data retention
* 6 shortcodes for flexible placement
* WordPress widget support
* HPOS (High-Performance Order Storage) compatible
* Translation ready

= Not what you needed? =

Please try other plugins from us:

- [WPC Product Bundles](https://wordpress.org/plugins/woo-product-bundle/ "WPC Product Bundles")
- [WPC Composite Products](https://wordpress.org/plugins/wpc-composite-products/ "WPC Composite Products")
- [WPC Grouped Product](https://wordpress.org/plugins/wpc-grouped-product/ "WPC Grouped Product")
- [WPC Frequently Bought Together](https://wordpress.org/plugins/woo-bought-together/ "WPC Frequently Bought Together")
- [WPC Force Sells](https://wordpress.org/plugins/wpc-force-sells/ "WPC Force Sells")

= Quick Start Guide (Using from Scratch) =

1. **Install & Activate**: Ensure WooCommerce 3.0 or higher is installed and activated, then activate WPC Smart Recommendations.
2. **Initial Scan & Fallback**: On activation, the plugin automatically scans past completed orders to build initial co-purchase data. For fresh stores with no order history, the plugin automatically falls back to category and store products so recommendations appear immediately.
3. **Configure Settings**: Go to **WP-admin > Recommendations** to adjust display positions, layouts, columns, and recommendation algorithms.
4. **Manual Recommendations (Optional)**: Edit any individual product in **WP-admin > Products**, go to the **Product Data > Recommendations** tab, and manually choose or reorder recommended products.
5. **View Results**: Visit any single product page or your cart page to see recommendations displayed.

= How to Configure =

All plugin options are organized under **WP-admin > Recommendations**:

* **General Settings**:
  * *Sort order*: Sort recommended products by relevance, price low to high, or price high to low.
  * *Exclude unpurchasable*: Hide out-of-stock and non-purchasable products.
  * *Exclude recently purchased*: Exclude items the shopper has bought in the last X days.
  * *Product link*: Open product links in the same tab, new tab, or trigger WPC Smart Quick View popup.
  * *Exclude product types*: Exclude variable, grouped, external, or custom product types.
* **Product Page Settings**:
  * *Position*: Choose where recommendation widgets appear (below add-to-cart form, below product summary, after related products, in a custom tab, or replace native WooCommerce related products).
  * *Layout*: Select Grid, Carousel (CSS scroll-snap slider), or List view.
  * *Columns & Limit*: Set columns (2 to 6) and maximum products to display (default: 8).
* **Cart & Checkout Settings**:
  * *Cart Position*: Display recommendations after cross-sells, before cross-sells, or replace standard cross-sells.
  * *Checkout Position*: Optionally display recommendations before or after order review or customer details.
* **Personalized & Trending Settings**:
  * *Personalized Popup*: Display a tailored "For You" popup once per session based on user browsing history.
  * *Trending Products*: Enable trending section with time-decay scoring across views, carts, and purchases.
* **Algorithms Settings**:
  * Enable or disable individual recommendation sources: Co-purchase, Co-view, Category Affinity, On-sale products, Wishlist, and Compare data.
* **Priority Rules**:
  * Create rules to boost, penalize, or exclude products based on condition criteria such as stock quantity, price, age in days, on-sale status, or category.

= How to Use Shortcodes =

Embed recommendation sections anywhere in posts, pages, or page builders using shortcodes:

* `[wpcrc_product]` — Display recommendations for a product.
  * `id`: Target product ID (optional, defaults to current product on single product pages).
  * `limit`: Number of products to show (default: 4).
  * `columns`: Number of columns (2 to 6, default: 4).
  * `layout`: Display layout: `grid`, `carousel`, or `list` (default: `grid`).
  * Example: `[wpcrc_product id="123" limit="4" columns="4" layout="grid"]`

* `[wpcrc_trending]` — Display trending products across the store.
  * `limit`: Number of products to show (default: 8).
  * `columns`: Number of columns (2 to 6, default: 4).
  * `layout`: Display layout: `grid`, `carousel`, or `list` (default: `grid`).
  * Example: `[wpcrc_trending limit="8" columns="4" layout="carousel"]`

* `[wpcrc_for_you]` — Display personalized recommendations for the current visitor.
  * `limit`: Number of products to show (default: 8).
  * `columns`: Number of columns (2 to 6, default: 4).
  * `layout`: Display layout: `grid`, `carousel`, or `list` (default: `grid`).
  * Example: `[wpcrc_for_you limit="6" columns="3" layout="grid"]`

* `[wpcrc_cart]` — Display recommendations based on current cart contents.
  * `limit`: Number of products to show (default: 4).
  * `columns`: Number of columns (2 to 6, default: 4).
  * `layout`: Display layout: `grid`, `carousel`, or `list` (default: `grid`).
  * Example: `[wpcrc_cart limit="4" columns="4" layout="grid"]`

* `[wpcrc_recent_viewed]` — Display recently viewed products.
  * `limit`: Number of products to show (default: 6).
  * `columns`: Number of columns (2 to 6, default: 6).
  * Example: `[wpcrc_recent_viewed limit="6" columns="6"]`

* `[wpcrc_order]` — Display recommendations based on items in an order (useful for custom thank you pages).
  * `id`: WooCommerce Order ID.
  * `limit`: Number of products to show (default: 4).
  * Example: `[wpcrc_order id="456" limit="4"]`

= Widget =

Go to **WP-admin > Appearance > Widgets** and add the **WPC Smart Recommendations** widget to any sidebar or widget area. Choose between personalized, trending, or cart-based recommendation modes.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install via **Plugins > Add New** in WordPress admin.
2. Activate the plugin through the **Plugins** menu.
3. Go to **WP-admin > Recommendations** to configure your desired settings and display positions.
4. The plugin will automatically start tracking customer behavior and building recommendations.

== Frequently Asked Questions ==

= Does this plugin work on a fresh store without sales history? =
Yes. For newly launched stores or test environments without past orders or visitor activity, the plugin automatically falls back to category-based and store products so recommendations appear immediately. As visitors browse and purchase items, the background engine builds co-purchase and co-view data to continuously refine recommendations.

= How do I display recommendations on single product pages? =
Go to **WP-admin > Recommendations > Product Page** and choose your preferred position from the dropdown (e.g., After Related Products, Below Add to Cart, Below Summary, or In a Tab). Recommendations will automatically appear on product pages without requiring code changes.

= Can I set manual recommendations for specific products? =
Yes. In **WP-admin > Products**, edit any product and scroll down to the **Product Data** box. Click the **Recommendations** tab on the left. Search and select products to recommend, and drag them to reorder. Manual recommendations are prioritized first.

= Does this plugin support WooCommerce HPOS (High-Performance Order Storage)? =
Yes, WPC Smart Recommendations is fully compatible with WooCommerce High-Performance Order Storage (HPOS) as well as traditional post meta storage.

= Does this plugin send data to external third-party services? =
No. All behavioral tracking, scoring algorithms, and recommendation computations are processed locally within your WordPress database. No external API keys or cloud subscriptions are required.

= Can I customize recommendation templates? =
Yes. All templates are located in the `/templates/` directory of the plugin. You can copy them into your theme or child theme folder to override the HTML layout and styles.

== Changelog ==

= 1.1.0 =
* Updated: Minor CSS/JS issues in the backend
* Updated: Compatible with WP 7.1 & Woo 11.1

= 1.0.1 =
* Update: Separate widget admin script into standalone file and enqueue properly
* Fix: Add missing capability and autosave checks in admin AJAX handlers and product meta saving

= 1.0.0 =
* Initial release
