=== CatCode Customers with Capsule CRM for WooCommerce ===
Contributors: catcodestudio
Tags: capsule, crm, contacts, woocommerce, customers
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sends WooCommerce customers to Capsule CRM as contacts when an order reaches the status you choose, without duplicates, with a tag and an order note.

== Description ==

You sell with WooCommerce and keep your customers in Capsule CRM. This plugin puts every buyer in Capsule, so nobody copies names and addresses by hand and no customer is missed.

Capsule is a third-party product. This is an independent integration, not affiliated with or endorsed by Capsule or Zestia Ltd.

= What it does =

* **Customer to contact.** When an order reaches the statuses you choose, the customer goes to Capsule as a person with name, e-mail, phone and billing address.
* **No duplicates.** The plugin looks the contact up in Capsule by the billing e-mail address and uses the one it finds instead of adding another.
* **What your team typed stays.** An existing contact only gets what it lacks: a phone or an address when it has none, the tag when it is not there. Or nothing at all, if you prefer.
* **Company.** A billing company name links the person to an organisation in Capsule.
* **Tag** of your choice on every contact that comes from the store, WooCommerce by default.
* **Order note in Capsule.** The order number, status, total, payment method and items are written to the history of the contact.
* **Test button** for the API token, and a log of what was sent.

= Built not to lose a customer =

* Jobs wait in a queue and run one at a time, in the background, so that checkout never waits for the CRM.
* If Capsule does not answer, the job is tried again later. If Capsule says its hourly call allowance is used up, the plugin waits until the time Capsule names and keeps every job.
* Calls are spaced out.
* The Activity tab shows what is waiting, what failed and why, with a Retry button.
* A staging copy stays quiet. If the site's address changes, sending stops until you confirm that this is the real store, otherwise test orders would reach your team as customers.

= What it does not do =

* It does not send anything back from Capsule to the store.
* It does not change or delete contacts when an order is cancelled.
* It does not find a contact by phone number: an order without an e-mail address is not sent.

// @pro-begin
= Pro =

Sold on [catcode.com.ua](https://catcode.com.ua/modules/capsule-crm-woocommerce/) with a 7-day trial:

* **Orders as opportunities.** Each order becomes an opportunity with the order total as its value and moves to the milestone you set for each order status.
* **Unfinished checkouts.** An order that was started with an e-mail address and not paid (left as Pending payment, Failed or Draft) becomes an opportunity; when the customer pays, the same opportunity moves on.
* **Tasks.** A task for your team when a payment fails or an order reaches the total you name.
* **Custom fields.** Your Capsule custom fields of contacts and opportunities filled from the order or from an order meta field.
* **Status notes.** Each order status you choose is written to the contact as a note.
* **Past orders** sent in bulk, by date or from the orders list.
* **E-mail alerts** when Capsule refuses the API token or an order gives up.

// @pro-end
== Installation ==

1. Install and activate the plugin. WooCommerce must be active.
2. In Capsule, open My Preferences > API Authentication and generate a personal access token. Tick “Create, update and delete information from your Capsule account” for it: without that the token can only read and nothing is sent.
3. Open **WooCommerce > Capsule**, paste the token and press Connect. It is kept encrypted with your site's keys.
4. On the **Customers** tab choose the order statuses and the other options.
5. Place a test order and check the contact in Capsule before relying on it.

== Frequently Asked Questions ==

= Does this need a CatCode account? =

No. The plugin talks to Capsule directly, with your own API token.

= Will old orders be sent when I connect? =

No. Only orders placed after connecting are sent automatically. An older one can be sent from its own screen.

= An order was not sent. What now? =

The Activity tab and a note on the order give the reason. Fix it and press Retry.

= Which token should I use? =

A personal access token of a Capsule user who may add and edit contacts. Contacts and notes are created in that user's name.

= Does it send data for customers who did not consent? =

The plugin sends customers of orders in the statuses you chose. Whether you may do that is decided by your privacy policy and the law that applies to your store, the UK GDPR for example. Developers can keep some orders out with the `catcode_cap_send_order` filter.

== External services ==

This plugin connects to Capsule CRM, a service run by a third party, because sending your customers there is its purpose.

It sends, from your server to the Capsule API (https://api.capsulecrm.com):

* when you connect or press the test button: your API token, to read the name of its user;
* when an order reaches a chosen status, or you press Send: a search for the contact by the customer's e-mail address, and, if there is none, the customer's first and last name, e-mail, phone, company name and billing address, along with the tag you set; then a note with the order number, status, total, payment method and item names. Once a month the list of country names is read from Capsule.

Nothing is sent before you enter your token. Capsule: [terms of service](https://capsulecrm.com/terms/), [privacy policy](https://capsulecrm.com/privacy/).

== Changelog ==

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.0.0 =
First release.
