=== CatCode Leads with LeadSquared for WooCommerce ===
Contributors: catcodestudio
Tags: leadsquared, crm, leads, woocommerce, india
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 LeadSquared as leads when an order reaches the status you choose, without duplicates.

== Description ==

You sell with WooCommerce and your sales team works in LeadSquared. This plugin puts every buyer in the CRM, so nobody copies names and phone numbers by hand and no customer is missed.

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

= What it does =

* **Customer to lead.** When an order reaches the statuses you choose, the customer goes to LeadSquared with name, e-mail, phone and company. Cash on delivery orders count from the moment they become Processing.
* **No duplicates.** LeadSquared looks for the lead by e-mail and phone, or by the one you choose, and updates it instead of adding another.
* **What your team typed stays.** By default only the empty fields of an existing lead are filled. You can choose to replace them or to change nothing.
* **Phones in international form.** 098450 98450 from an Indian order reaches LeadSquared as +919845098450.
* **Address, when your account has the fields.** City, state, PIN and country go to the standard mx_City, mx_State, mx_Zip and mx_Country fields, with Maharashtra written out instead of MH.
* **Lead source** of your choice for new leads. LeadSquared keeps the source a lead already has.
* **Every API region** of LeadSquared, including India (Mumbai) and India (Hyderabad). If the region is wrong, the plugin corrects it when LeadSquared names the right one.

= 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 LeadSquared does not answer, the job is tried again later. If the call limit is reached, the plugin waits as long as it was told and keeps every job.
* Calls are spaced to stay inside the limit of the smallest plan.
* 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 sales team as customers.

= What it does not do =

* It does not send anything back from LeadSquared to the store.
* It does not change or delete leads when an order is cancelled.

// @pro-begin
= Pro =

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

* **Order timeline.** Each order status you choose appears as an activity on the lead, with order number, status, total, currency, payment method and the items bought. Your team sees what the customer bought right on the lead.
* **Lead stage after a purchase**, Customer for example, from the stages of your own account.
* **Any lead field**, including your custom ones, filled from the order or from an order meta field.
* **Campaign.** Source Campaign, Source Medium and Source Content filled from WooCommerce order attribution (UTM).
* **Send past orders** in bulk from the orders list.
* **E-mail alerts** when LeadSquared refuses the keys or an order gives up.

// @pro-end
== Installation ==

1. Install and activate the plugin. WooCommerce must be active.
2. In LeadSquared, open My Account > Settings > API and Webhooks and copy the Access Key and the Secret Key.
3. Open **WooCommerce > LeadSquared**, choose the region and paste the keys. They are kept encrypted with your site's keys.
4. On the **Leads** tab choose the order statuses and the other options.
5. Place a test order and check the lead in LeadSquared before relying on it.

== Frequently Asked Questions ==

= Does this need a CatCode account? =

No. The plugin talks to LeadSquared directly, with your own keys.

= 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.

= Does it use up my API calls? =

One call per customer sent. LeadSquared limits calls per day by plan, and all tools on one account share the count. The Activity tab shows the calls made today.

= Which keys should I use? =

Those of an active administrator. LeadSquared applies the permissions of the user whose keys are used, and the keys stop working when that user is deactivated.

= 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. Developers can keep some orders out with the `catcode_lsq_send_order` filter.

== External services ==

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

It sends, from your server to the LeadSquared API host of the region you choose (for example api-in21.leadsquared.com):

* when you connect or press the test button: your Access Key and Secret Key, to read the list of your lead fields;
* when an order reaches a chosen status, or you press Send: the customer's first and last name, e-mail, phone, company and, if your account has the fields, city, state, postcode and country, along with the lead source you set.

Nothing is sent before you enter your keys. LeadSquared: [terms of service](https://www.leadsquared.com/terms-of-service/), [privacy policy](https://www.leadsquared.com/privacy-policy/).

== Changelog ==

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.0.0 =
First release.
