=== Loyvo for WooCommerce ===
Contributors: loyvo
Tags: sms, woocommerce, sri lanka, order notifications, loyalty
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 8.0
Stable tag: 0.1.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Order SMS for Sri Lankan customers through Loyvo: a text when an order is processing, completed and more, plus new-order alerts.

== Description ==

Loyvo for WooCommerce sends SMS through [Loyvo](https://loyvo.lk) when orders change status.

* **Customer SMS for any order status** (Processing and Completed are on by default), each with its own message.
* **Placeholders:** {first_name}, {last_name}, {order_id}, {total}, {status}, {shop_name}, {items}, {order_date}.
* **Live counter:** see characters and SMS parts as you type, including Sinhala and Tamil (Unicode) messages.
* **New order alerts** to your own phone numbers.
* **Sends in the background** with WooCommerce's scheduler, so checkout is never slowed down; retries if Loyvo is briefly unreachable, and never sends the same message twice.
* **Order notes** record every SMS sent or failed.
* **Test keys** let you try everything without sending or paying.
* Works with the block checkout and High-Performance Order Storage (HPOS).

You need a Loyvo account (free trial at [loyvo.lk](https://loyvo.lk)) with an approved sender ID and SMS credits.

= External service =

This plugin sends order SMS through the Loyvo API at https://api.loyvo.lk, operated by Loyvo. For each SMS it sends the customer's phone number, the message text (which can include their name, order number and total) and an order reference. Nothing is sent until you add an API key. Loyvo [terms of service](https://loyvo.lk/terms/) and [privacy policy](https://loyvo.lk/privacy/).

== Installation ==

1. Upload the plugin and activate it (WooCommerce must be active).
2. In [app.loyvo.lk](https://app.loyvo.lk) → Settings → API keys, create a key with "Send SMS" and "Read messages".
3. Go to WooCommerce → Settings → Loyvo, paste the key and save. You will see "Connected to <your business>".
4. Choose your sender ID, adjust the messages and use "Send test SMS" to check.

== Frequently Asked Questions ==

= Which numbers get SMS? =

The order's billing phone, when it is a Sri Lankan mobile number (07X XXX XXXX in any common format). Other numbers are skipped with an order note.

= Why does my message count as several SMS? =

A standard SMS holds 160 characters. Sinhala, Tamil and emoji make the message Unicode, which holds 70 (67 per part when longer). The counter under each message shows how many parts it will use. Every default message fits in one standard SMS.

= Do I need a Loyvo account? =

Yes. Sign up at [loyvo.lk](https://loyvo.lk), get a sender ID approved and add SMS credits. Each SMS part uses one credit.

= Can I try it without sending real SMS? =

Yes. Create a test key (lvo_test_…) in app.loyvo.lk. Everything works the same, but nothing is delivered and no credits are used. Order notes say "test key: not delivered".

= Will a customer ever get the same SMS twice? =

No. Each order and status is sent once, even if WooCommerce triggers the status change twice or a send is retried.

= What if Loyvo is unreachable? =

The SMS is tried again after 5, 10 and 15 minutes. If it still fails, the order note says why.

= Does checkout wait for the SMS? =

No. SMS are sent in the background with WooCommerce's scheduler.

= Does it work with the block checkout and HPOS? =

Yes, both.

= Can I write messages in Sinhala or Tamil? =

Yes. Type them in the message boxes. The counter shows the Unicode SMS count.

== Screenshots ==

1. A message for each order status, with placeholders and a live SMS counter (here one message is in Sinhala).
2. New order alerts to your own numbers, and a test SMS button.
3. Connected to your Loyvo account: your business, live or test, SMS credits and your approved sender IDs.
4. Every SMS is recorded on the order: the customer's Processing and Completed messages and the shop's new-order alert.

== Upgrade Notice ==

= 0.1.1 =
The plugin folder is now loyvo-for-woocommerce. If you installed 0.1.0 from GitHub, deactivate and delete it, then install 0.1.1 and enter your API key again.

== Changelog ==

= 0.1.4 =
* API calls no longer retry or wait inside a page request; failed order SMS are retried by Action Scheduler.
* Build files removed from the plugin zip.

= 0.1.3 =
* Plugin header: Author URI only (WordPress.org needs the plugin and author URIs to differ).

= 0.1.2 =
* Clearer order notes, e.g. "Loyvo: Completed SMS sent to 9477… · 1 SMS".

= 0.1.1 =
* Plugin folder and text domain renamed to loyvo-for-woocommerce (WordPress.org naming rules).
* Passes the WordPress Plugin Check with no errors or warnings.

= 0.1.0 =
* First release: order status SMS, new order alerts, test SMS, order notes.
