=== WebSkyLink Request a Quote ===
Contributors: vrvijendra007
Tags: woocommerce, quote, request a quote, catalog mode, hide price
Requires at least: 5.6
Tested up to: 7.1
Requires PHP: 7.2
Requires Plugins: woocommerce
Stable tag: 1.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Let customers build a quote list instead of buying straight away, then turn an accepted quote into a real WooCommerce order.

== Description ==

Some products do not have a fixed price. Bulk orders, made to measure goods, trade pricing and B2B catalogs all need a conversation before a sale. This plugin adds that conversation to WooCommerce.

Customers collect products into a quote list, send you a request, and you price it up in the admin. When you send the quote back, they can accept it with one click, which creates a normal WooCommerce order at the prices you agreed and takes them to checkout.

= How it works =

1. A customer clicks **Add to quote** instead of Add to cart.
2. They review their list on the quote page and send a request.
3. You get an email and see the request under Webskylink Suite > Quote requests.
4. You set a price per line, add discount, shipping or extra costs, set an expiry date, and email the quote out.
5. The customer accepts or rejects. Accepting creates a WooCommerce order at the quoted prices and sends them to pay.

= Features =

* "Add to quote" button on single product pages and shop listings, with your own label.
* Catalog mode: hide prices, hide the add to cart button, or both.
* Apply the rules to the whole shop, or only to chosen products and categories, with exclusion lists that always win.
* Restrict quoting to logged in users, guests, or specific user roles.
* Quote list stored per visitor, working for guests and logged in customers alike.
* Configurable request form: name, email, phone, company, address and message, each optionally required.
* Optional privacy consent checkbox, plus a honeypot field to deter bots.
* Quote requests stored with their own statuses: new request, quote sent, accepted, rejected and expired.
* Admin editor for per line quoted prices, discount, shipping, additional costs and a note to the customer.
* Expiry dates, with a daily task that expires overdue quotes automatically.
* One click accept and reject from the email or the customer's account, with an optional reason on rejection.
* Accepting a quote creates a real WooCommerce order at the quoted prices and redirects to payment.
* Quotes section in My Account so customers can review their history.
* Shortcodes and a widget for the quote list and item count.
* A Webskylink Suite dashboard with live quote statistics, a setup checklist and recent activity.
* Templates can be overridden from your theme.
* Works with High Performance Order Storage (HPOS) and the block based checkout.

= PDF quotes and other extras =

Everything below is included, with nothing held back for a paid version.

* **PDF quote documents.** Every quote can be downloaded as a tidy, branded PDF from the admin, from the customer's account page and from the quote email. The file is built on the fly with no third party library and nothing is stored on your server.
* **PDF email attachment.** Optionally attach the PDF when you email a quote, so the customer has a copy to file or forward.
* **Expiry reminders.** A daily task emails the customer a reminder a set number of days before their quote runs out. One reminder per quote, never a loop.
* **Quote numbers.** Quotes are referenced as QT-00042 rather than a raw post ID, with your own prefix and number length. The reference is used on screen, in every email and on the PDF.
* **Copy a quote.** Duplicate any quote in one click to reuse the pricing for a repeat customer. Line items, adjustments and notes carry over; the expiry, token, decision and linked order do not.
* **CSV export.** Export quote requests from the list screen, honouring whichever status filter is active. Values that a spreadsheet would treat as a formula are neutralised.
* **Bulk status changes.** Move several quotes to a new status at once from the list screen.
* **Quote history.** Each quote keeps an audit trail of what happened and when: requested, emailed, reminded, accepted, rejected, expired or copied, and who did it.

= Six notification emails =

All of them use the WooCommerce email template, so they inherit your existing header, footer and colours.

1. New quote request, to you.
2. Request received, to the customer.
3. The priced quote, to the customer, optionally with the PDF attached.
4. Expiry reminder, to the customer.
5. Quote accepted, to you.
6. Quote rejected, to you.

= Shortcodes =

* `[webskylink_quote_list]` renders the quote list and request form. Placed on the quote page automatically.
* `[webskylink_quote_count]` outputs the number of items in the visitor's quote list.
* `[webskylink_quote_button id="123"]` renders an Add to quote button for a specific product.

== Installation ==

1. Upload the `webskylink-request-a-quote` folder to `/wp-content/plugins/`, or upload the zip through Plugins > Add New > Upload Plugin.
2. Activate the plugin. A "Request a quote" page is created for you, and a Webskylink Suite menu is added.
3. Open Webskylink Suite for the dashboard, or WooCommerce > Settings > Request a Quote to configure the button, catalog rules, form, PDF documents and emails.

== Frequently Asked Questions ==

= Do I have to hide my prices? =

No. Catalog mode is off by default, so quoting runs alongside normal selling. Turn on price hiding or add to cart hiding only if you want a catalog.

= Can I limit quotes to certain products? =

Yes. Under Catalog mode, set "Rules apply to" to the selected products and categories, then pick them. Exclusion lists always take priority.

= What happens when a customer accepts? =

The plugin creates a WooCommerce order containing the same products at the prices you quoted, applies your discount, shipping and extra costs, and sends the customer to pay for it. The order appears in WooCommerce as normal.

= Can guests request a quote? =

Yes. The quote list works from the WooCommerce session, and quote links are secured with a per quote token so guests can open their quote from the email.

= Does it generate PDF quotes? =

Yes. The PDF is written by the plugin itself, so there is no library to install and no server side rendering service involved. It uses A4 pages and the standard Helvetica faces, and spills onto extra pages when a quote has a lot of lines. Turn it on or off, and choose whether to attach it to the quote email, under WooCommerce > Settings > Request a Quote > PDF documents.

= Can I change the quote reference format? =

Yes. Set a prefix and a number length under WooCommerce > Settings > Request a Quote > General. Quotes are numbered from their WordPress post ID, so references are unique and never reused.

= How do the expiry reminders work? =

Once a day the plugin looks for sent quotes that expire within the number of days you set, and emails each customer once. Quotes without an expiry date are skipped, and setting the value to 0 turns reminders off.

= Where does the CSV export come from? =

The Export CSV button sits next to the status filter on Webskylink Suite > Quote requests. It exports whatever the filter is showing, reading the database in pages so a large quote history cannot exhaust memory.

== Changelog ==

= 1.1.2 =
* Improved: a failed "Add to quote" request now shows the actual server response in the on-screen message, to make failures diagnosable without opening browser developer tools.

= 1.1.1 =
* Fix: a guest's quote list could disappear on their next page view. Adding a quote never touched the WooCommerce cart, so the guest's session cookie was never sent to their browser, and their list saved under a session they could not return to. Logged in customers were not affected, since their list is also kept in their account.
* Improved: the Add to quote button has a dedicated design instead of inheriting the theme's plain button style, with its own icon, hover and loading states.

= 1.1.0 =
* New: PDF quote documents, generated without any third party library, downloadable from the admin, the customer account and the quote email.
* New: optionally attach the PDF to the quote email.
* New: expiry reminder email, sent once per quote a configurable number of days before it expires.
* New: quote references such as QT-00042, with a configurable prefix and number length, used on screen, in emails and on the PDF.
* New: copy a quote from the list screen or the quote editor to reuse its pricing.
* New: export quote requests to CSV, honouring the active status filter.
* New: bulk status changes from the quote list screen.
* New: per quote history panel recording requests, emails, reminders, decisions and copies.
* Fix: the Webskylink Suite menu registered too late, so the top level link opened the quote list instead of the dashboard.
* Fix: a customer's message lost its line breaks when the request was saved, and again when the form was redisplayed after a validation error.
* Fix: default option values were translated on every request, which triggers the WordPress 6.7 notice about loading translations before the init hook.
* Fix: the quote editor could fatal on PHP 8 if a crafted request posted an array as a quoted price.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.1.1 =
Fixes a guest quote list disappearing between page loads, and redesigns the Add to quote button. Recommended for everyone on 1.1.0.

= 1.1.0 =
Adds PDF quotes, expiry reminders, quote references, CSV export, bulk actions and a per quote history, and fixes an admin menu ordering bug plus three input handling bugs.
