=== CETECommand ===
Contributors: beyondtomorrowenterprises
Tags: enquiry form, live chat, client portal, woocommerce, quotes
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.1.0
WC requires at least: 6.0
WC tested up to: 10.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Enquiry form, website chat and client portal from CETECommand, your form entries sent in as enquiries, and WooCommerce orders sent in as invoices.

== Description ==

For businesses on CETECommand (quotes, jobs and invoicing with private team chat).

* Enquiry form in your colours: quote and maintenance requests with photos, straight into CETECommand, Jobs, Enquiries. Shortcode [cete_enquiry_form] (options: type="work_order" or type="quote", service, title).
* Website chat button on every page. You answer in CETECommand; replies reach visitors by email if they have left.
* Client portal link: customers sign in with their email to see their jobs, approve quotes and pay invoices. Shortcode [cete_client_login].
* Your existing forms: Contact Form 7, WPForms and Elementor Pro form entries sent in as enquiries (needs an API key).
* WooCommerce (optional, see below): chat on shop pages, a quote request button on products, orders sent in as invoices, and a client portal link in My Account.
* For developers: do_action('cetecommand_send_enquiry', $data) sends anything in, the cetecommand_enquiry_data filter adjusts what is sent, and the cetecommand_chat_here filter decides which pages get the chat.

= WooCommerce =

A WooCommerce section appears in Settings, CETECommand when WooCommerce is active. Everything in it is off until you tick it.

* Chat on shop pages: show the chat button on product pages, the cart and checkout only (or on every page with Website chat).
* Product questions: a "Questions about this product?" link under Add to cart that opens the chat. If the chat is off in CETECommand it opens your booking page instead. Shortcode [cete_product_question].
* Quote request button: for products you quote rather than sell. On every product or only on products with no price. It opens your enquiry form with the product name (and SKU) filled in. Shortcode [cete_quote_button] (options: label, service).
* Orders into CETECommand: paste the shop orders address from CETECommand and press Connect. The plugin adds WooCommerce's own webhooks for Order created and Order updated, so each order becomes an invoice and paid orders are marked paid. Needs the Business plan.
* My Account: a "Your jobs and invoices" link to your client portal, shown only while Client portal is on in CETECommand.

Works with WooCommerce's order tables (HPOS) and the block cart and checkout.

= Outside services =

This plugin connects to CETECommand (https://app.cetechat.com), run by Beyond Tomorrow Enterprises Pty Ltd. Terms: https://cetecommand.com/terms.html Privacy: https://cetecommand.com/privacy.html

* Pages with the enquiry form, the chat, the quote button or the questions link load https://app.cetechat.com/w/v1.js, which shows the form and chat from CETECommand. Visitors' browsers send what they type there.
* Form entries (Contact Form 7, WPForms, Elementor) are sent to CETECommand when you turn that on.
* When you connect shop orders, WooCommerce sends each new or changed order (customer details, items and totals) to your CETECommand address.
* When the My Account link is on, your site checks twice a day (and when you save) whether your client portal is on. Nothing is sent about your customers.

== Installation ==

1. Plugins, Add New, Upload Plugin, choose cetecommand.zip, Install Now, Activate.
2. In CETECommand: Jobs, Settings, Booking page. Turn on the booking page, add this website to "Your websites" and save. Copy the data-key from Website code.
3. In WordPress: Settings, CETECommand. Paste the booking key and tick what you want.
4. For your existing forms: in CETECommand, Jobs, Settings, API and webhooks, make a key. Paste it in WordPress, save, and press "Test the API key".
5. For WooCommerce orders: in CETECommand, Invoicing, Settings, Shop orders, press "Turn on shop orders" and copy the address. In WordPress, Settings, CETECommand, paste it under "WooCommerce orders into CETECommand" and press Connect.

== Frequently Asked Questions ==

= I already added WooCommerce webhooks by hand. Will I get two invoices per order? =

No, CETECommand never makes two invoices for the same order. But you only need one set: delete your own CETECommand webhooks in WooCommerce, Settings, Advanced, Webhooks, after you press Connect.

= Does "Send a test" make an invoice? =

No. It sends the same test message WooCommerce sends when a webhook is made, and shows whether CETECommand accepted the address. Place a real test order to see an invoice.

= The test says the address was not accepted. =

The address may have been replaced. In CETECommand, making a new address stops the old one. Make a new one, paste it and press Connect again.

= Orders stopped coming in. =

WooCommerce turns a webhook off after several failed deliveries in a row. Settings, CETECommand shows this. Press Connect again (with the same address) to turn it back on.

= What happens when I turn the plugin off or delete it? =

Turning the plugin off pauses its webhooks, and turning it back on starts them again. Disconnect or deleting the plugin removes them. Invoices already made stay in CETECommand.

= The quote form does not show the product name. =

If you have a list of services in CETECommand, the form shows that list and the product name is in the form's title. Leave the list empty to have the product name filled in.

= The "Your jobs and invoices" link is not showing. =

It shows only while Client portal is on in CETECommand (Jobs, Settings, Booking page). After turning it on, press "Check now" next to the My Account setting.

== Changelog ==

= 1.1.0 =
* WooCommerce: chat on product pages, cart and checkout.
* WooCommerce: "Questions about this product?" link and [cete_product_question] shortcode.
* WooCommerce: quote request button on products and [cete_quote_button] shortcode.
* WooCommerce: connect shop orders to CETECommand invoicing in one step, with a test button and status.
* WooCommerce: "Your jobs and invoices" link in My Account.
* Webhooks are paused when the plugin is turned off and removed when it is deleted.
* New cetecommand_chat_here filter.

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.1.0 =
Adds optional WooCommerce features. Nothing changes until you turn them on.
