=== Push SMS BD for WooCommerce ===
Contributors: anikriz
Tags: sms, bangladesh, bangla sms, woocommerce, order notification
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 7.0
WC tested up to: 10.9
Stable tag: 1.3.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Order SMS for WooCommerce stores in Bangladesh, in Bangla or English. No gateway account needed. 30 free credits to try it.

== Description ==

Tell your customers in Bangladesh what is happening with their order, by SMS, in Bangla or
English — without setting up an SMS gateway account of your own.

Most SMS plugins ask for an API key, a sender ID and a gateway URL before they will send
anything, which means signing up with a provider, waiting for approval, and topping up a
separate account. This one asks for your email address and your shop name. That is the
whole setup.

**Anyone can install this and start sending.** Connecting gives you **30 free credits**,
with no card and no trial period — enough for **30 English or 15 Bangla order messages**.
Nothing expires and nothing switches off; when the free credits run out you buy more, or
you stop.

**This plugin is a client for a paid SMS service.** Mobile operators charge for every SMS
delivered, so the messages themselves cost money: **৳0.40 per credit**, bought in advance.
The plugin, all of its features, and the free credits cost nothing. There is no premium
version, no monthly fee, and no feature held back behind a payment.

**What it does**

* An SMS to your customer whenever an order changes status — you choose which statuses
* An SMS to you when a new order arrives
* Works with **custom order statuses** added by other plugins, not just WooCommerce's own
* **Full Bangla support**, including Bengali digits in phone numbers
* Phone numbers cleaned up automatically — `01712345678`, `+8801712345678` and
  `০১৭১২৩৪৫৬৭৮` all work
* A live counter while you write, showing exactly how many credits a message will cost
* A log of every message with the reason when one does not arrive
* Send a one-off SMS from any order screen
* Quiet hours, so order updates do not wake people at 3am
* Sending happens in the background — checkout is never slowed down

**How credits work**

One credit sends one SMS part.

* English, up to 160 characters — **1 credit**
* Bangla, up to 70 characters — **1 credit**
* Bangla, 71 to 134 characters — **2 credits**

Bangla uses a different encoding that fits fewer characters per message, which is why a
normal Bangla order message costs two credits rather than one. **This is why the free
grant is described as 30 credits and not 30 messages** — in Bangla it is about 15. The
editor shows the exact cost as you type, before you send anything.

**You are only charged for messages that actually go out.** If a number is invalid, or the
gateway rejects a message, nothing is deducted.

== External services ==

This plugin connects to **Push SMS**, a service operated by Host The Website, to deliver
your messages. The plugin cannot send SMS on its own.

**What is sent, and when**

Each time an order reaches a status you have enabled, or you send a message manually, the
plugin sends the following to `https://sms.hostthewebsite.com`:

* the recipient's mobile number
* the message text, which may include the customer's name, order number, order total and a
  tracking link, depending on the templates you write
* the order ID and which status triggered the message
* your site's access token, which identifies your store

When you first connect, it also sends your site URL, your email address, your store name,
your timezone, and your WordPress, WooCommerce and plugin versions.

The service stores this in order to deliver the messages, show you a delivery log, and keep
track of your credit balance. Your email address is used for receipts and low-balance
warnings.

Nothing is sent anywhere until you connect the plugin, and nothing is sent for order
statuses you have not enabled.

* Terms of service: https://sms.hostthewebsite.com/terms
* Privacy policy: https://sms.hostthewebsite.com/privacy

You are responsible for having your customers' consent to message them.

== Installation ==

1. Install and activate the plugin.
2. Go to **WooCommerce → SMS**, enter your email address and your shop name.
3. You now have 30 free credits — about 30 English or 15 Bangla messages.
4. Open **Order Notifications**, switch on the statuses you want, and edit the wording.
5. Place a test order, or send a test SMS from the **Balance** tab.

== Frequently Asked Questions ==

= Do I need an SMS gateway account? =

No. That is the point of this plugin. The service holds the gateway account; you buy
credits from it.

= Why did my Bangla message cost 2 credits? =

Bangla is sent using an encoding that fits only 70 characters per SMS, against 160 for
English. A normal Bangla order message is therefore two credits. The counter under every
template shows this before you send anything, and writing in English halves the cost.

= What number do my customers see? =

Messages arrive from a shared sender number, not your shop name. So your shop name is added
to the front of every message automatically — you give it when you connect, and it appears
as a locked strip above each template so you can see exactly what goes out. Without it a
customer has no way to tell who is writing to them, which is what a scam SMS looks like.

= Is this free? =

The plugin is free and every feature in it is free. The SMS are not, because mobile
operators charge for delivery. You get 30 credits free when you connect, and after that
credits cost ৳0.40 each with a minimum top-up. Nothing is locked behind a payment and there
is no paid version of this plugin.

= What happens when I run out of credits? =

Sending stops, and each message that could not be sent is recorded in the log as skipped so
you can see exactly what was missed. You will see a notice in the admin, and an email.
Nothing is lost — top up and new orders start sending again.

= Am I charged if a message fails? =

No. You are only charged for messages the gateway accepts. Invalid numbers and rejected
messages are logged and cost nothing.

= Does it work with my custom order statuses? =

Yes. Every status registered on your store appears on the Order Notifications screen,
including ones added by other plugins.

= Does it work with High-Performance Order Storage? =

Yes.

= What happens to my credits if I deactivate the plugin? =

Nothing — they are held by the service, not in your WordPress database. Reconnect with the
same email address and they are still there.

== Screenshots ==

1. Connect your store with an email address and your shop name, and get 30 free credits.
2. Choose which order statuses send an SMS, and what each one says.
3. The counter shows exactly how many credits a message will use as you type.
4. Your balance, recent usage, and a test sender.
5. Every message logged, with the reason when one does not arrive.

== Changelog ==

= 1.3.0 =
* Renamed to Push SMS BD for WooCommerce, after the service it connects to.

= 1.2.5 =
* Passes the Plugin Check tool with no errors.
* Translations are now loaded by WordPress itself, as it has done for directory-hosted plugins since 4.6.

= 1.2.4 =
* Fixed: the live credit counter under each template had been showing nothing since 1.1.1. Redrawing the template box in that release moved the counter outside the element the script looks in, so it silently stopped updating. It now sits inside the box and reports again.
* "1 credit" instead of "1 credits".

= 1.2.3 =
* Listing details for the WordPress.org directory.

= 1.2.2 =
* The admin screens still said the old name in a few places. They now say SMS BD.

= 1.2.1 =
* Internal: class and constant names now use a longer prefix, and the code passes the WordPress Coding Standards checks the plugin directory runs. No change to how anything behaves, and stored settings are untouched.

= 1.2.0 =
* Renamed to SMS BD for WooCommerce, so it is obvious the service delivers to Bangladesh.
* The free grant is now described as 30 credits rather than 30 SMS, with what that means in Bangla stated plainly. A Bangla order message costs two credits, so 30 credits is about 15 Bangla messages — saying "30 SMS" was setting people up to feel short-changed on their first day.

= 1.1.5 =
* Sending an SMS about an order, and resending one from the log, now require permission for that order rather than general store access.
* The service address can no longer be changed by a filter, only by a constant in wp-config.php. Every request carries your site token, so whatever sets that address decides who receives it.

= 1.1.4 =
* Fixed: a message that failed for good — no credits, no shop name — left the order marked as handled, so setting the status again did nothing. Those cases now clear themselves, and re-triggering the status sends.
* Fixed: on a store that upgraded while connected, a failed shop-name lookup repeated on every admin page load.
* Hardened: the plugin now refuses to send its site token to anything but HTTPS, and the tracking link is validated as a URL.

= 1.1.3 =
* After paying, the "Back to your dashboard" button now lands you on the Balance tab with a confirmation and your new balance already loaded.
* Cancelled and failed payments say so plainly instead of leaving you guessing.

= 1.1.2 =
* Fixed: "Remove the duplicate shop name" and "Save shop name" both failed with "Link expired". Their security tokens were issued under the wrong name.

= 1.1.1 =
* The shop name now shows as a locked strip at the top of each template box, so it is obvious that it is sent first and cannot be edited.
* Added a one-click fix for templates written before 1.1.0, which said the shop name a second time and charged for it.
* Fixed: stores that were already connected when they upgraded never saw their shop name at all, because it is only fetched on connect. It is now fetched when missing.

= 1.1.0 =
* Your shop name is now added to the start of every message, so customers can tell who is writing to them. Messages are sent from a shared number, and one from an unknown number reads like a scam.
* The shop name is asked for when you connect, and can be changed on the Settings tab.
* Credit estimates now include the shop name, so the number you see before sending is the number you are charged.
* Default templates no longer repeat the shop name, since it is added automatically.
* Fixed: a syntax error stopped the admin JavaScript running at all, which broke the live credit counter, the placeholder buttons and the test-send button.

= 1.0.0 =
* First release.
