=== Flowbyte Cart Quote Manager for WooCommerce ===
Contributors: wojciechborowicz
Tags: woocommerce, quotes, abandoned carts, pdf quotes, cart recovery
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Auto-save every WooCommerce cart for follow-up, let customers download PDF quotes, and send email reminders — all from one admin dashboard.

== Description ==

Flowbyte Cart Quote Manager for WooCommerce adds two powerful capabilities to your WooCommerce store:

**PDF Quotes** — A "Download Quote" button on the cart page opens a modal where customers enter their details and instantly receive a professionally formatted PDF. Each quote is stored in the database with a unique reference number and a secure restore-cart link so the customer can pick up where they left off.

**Cart Tracking** — Every WooCommerce cart is automatically saved in real time. Carts that go idle for more than 30 minutes are flagged as abandoned. When a cart converts to an order it is marked as converted. A WordPress Dashboard widget gives you a quick glance at open, abandoned, converted and quoted activity.

**Admin Dashboard** — A unified list of all carts and quotes with sorting, filtering, a detail view with product table, customer info, custom field data, and technical details (IP address, browser). From any entry you can compose an email or download a PDF.

**Automated Reminders** — Uses WooCommerce Action Scheduler to automatically email customers about abandoned carts or outstanding quotes after a configurable number of days.

= Key Features =

* One-click PDF quote generation with customisable header, accent colour and logo
* Auto-save every WooCommerce cart in real time
* Abandoned cart detection (30-minute idle threshold)
* Automated email reminders via Action Scheduler
* Admin email composer with WooCommerce-styled templates
* Single detail page per cart/quote with product images, totals and customer data
* Dashboard widget with Open / Abandoned / Converted / Quotes stats
* Customisable form fields — add unlimited custom fields (text, email, tel, textarea, select, checkbox, number)
* Built-in fields for Name, Email, Phone, Company and Notes — each set to Required, Visible or Hidden
* Fully customisable button, modal and PDF styling from settings
* Secure cart-restore links with nonce protection
* Quote and cart reference number offset for sequential numbering
* Records customer IP address and browser for every entry
* Works for both logged-in and guest customers

== Installation ==

1. Upload the `flowbyte-cart-quote-manager-woocommerce` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **Carts & Quotes > Settings** to configure your options.

The plugin automatically creates two database tables on activation (`wp_fbcqm_quotes` and `wp_fbcqm_saved_carts`). WooCommerce must be active.

== Configuration ==

= General Tab =

* **Auto-save carts** — Toggle real-time cart tracking on or off.
* **Enable Quote Button** — Show or hide the "Download Quote" button on the cart page.
* **Admin List Default View** — Choose whether the admin list shows both carts and quotes, or only one type.
* **Quote/Cart Number Offset** — Add an offset to reference numbers (e.g. set 1000 so the first quote is Q-01001).

= Fields Tab =

* Configure visibility (Required / Visible / Hidden) for each of the 5 built-in fields: Full Name, Email, Phone, Company, Notes.
* Add unlimited custom fields with a label, field type, required flag and options list (for select fields).
* Reorder fields with up/down buttons — the order is reflected in both the frontend modal and the PDF.

= Style Tab =

* **Button** — Background colour, text colour, border radius, button wording.
* **Modal** — Background colour, text colour, border radius, submit button colours.
* **PDF** — Header colour, accent colour, logo image (uploaded via Media Library).

= Email Tab =

* **Cart Reminder** — Subject and body template for abandoned cart emails.
* **Quote Reminder** — Subject and body template for quote follow-up emails.
* **Auto-Reminders** — Enable/disable and set the number of days before a reminder is sent.
* Templates support placeholders: `{customer_name}`, `{restore_url}`, `{cart_total}`, `{items_list}`, `{site_name}`, `{quote_ref}`.

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes. WooCommerce must be installed and active.

= How does cart tracking work? =

When "Auto-save carts" is enabled the plugin hooks into WooCommerce cart events (add, remove, quantity change, totals calculation) and persists the cart to the database. Each user or guest session gets one open cart row that is updated on every change.

= When is a cart considered abandoned? =

A cart is flagged as abandoned when its last activity is more than 30 minutes ago and it has not been converted to an order.

= Can I customise the PDF? =

Yes. Under Settings > Style you can set the header colour, accent colour and upload a logo. If no logo is configured the site name is displayed instead. Colours and logo appear in both the header and footer of the PDF.

= Do automated reminders require anything extra? =

The plugin uses WooCommerce's built-in Action Scheduler (included with WooCommerce). No additional plugin is needed. Reminders run once daily at 8:00 AM site time and process up to 50 carts per run.

= Does the PDF include custom fields? =

Yes. Any custom fields the customer fills in are stored with the quote and rendered in the PDF between the customer details and the product table.

= Can guest (non-logged-in) customers use the quote form? =

Yes. The quote modal and AJAX endpoint work for both logged-in and anonymous users. Guest carts are tracked by WooCommerce session ID.

== Screenshots ==

1. Frontend quote modal on the cart page.
2. Admin dashboard list with carts and quotes.
3. Single detail page with product table.
4. PDF quote output.
5. Settings — General tab.
6. Settings — Fields tab with custom fields.
7. Settings — Style tab.
8. Dashboard widget with activity stats.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
