=== SitesPlaced for WooCommerce ===
Contributors: sitesplaced
Tags: woocommerce, order tracking, shipping, whatsapp, order management
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Copy WooCommerce orders to SitesPlaced: an order dashboard, mobile app, courier booking, WhatsApp order messages and a tracking page.

== Description ==

SitesPlaced for WooCommerce copies the orders from your WooCommerce shop into a SitesPlaced store. You keep selling on WooCommerce exactly as you do today. SitesPlaced gives you a second place to handle what happens after the order:

* An order dashboard on the web and a mobile app, with a notification when a new order arrives.
* Courier booking from the order.
* WhatsApp order messages, if you connect WhatsApp in SitesPlaced.
* A tracking page for your shoppers, with your shop's name on it.

**WooCommerce stays in charge.** Payment, stock, prices, refunds and cancellation all stay in WooCommerce. SitesPlaced sends back only two things: the shipping status (shipped, out for delivery, delivered) and the tracking details (courier, tracking number, link).

= What the plugin does =

* **One-click connect.** Press "Connect to SitesPlaced", sign in, confirm your shop's address, and you are back in wp-admin. You can also paste a key by hand.
* **Live order sync.** New orders, edits, status changes, refunds, trashed and restored orders are sent in the background through Action Scheduler (it ships with WooCommerce). Your checkout never waits for SitesPlaced.
* **Import past orders.** Bring in the last 30, 90 or 365 days. History is imported quietly: no notifications, no WhatsApp messages.
* **Products.** A read-only copy of your products is kept in SitesPlaced. You can switch this off.
* **Tracking comes back.** The courier and tracking number are saved on the WooCommerce order, added as an order note, shown on the order screen in wp-admin, shown to the shopper in My Account, and added to customer emails. The order can be marked Completed when it ships (you can switch this off).
* **Shortcode.** `[sitesplaced_tracking]` adds an order tracking form to any page. It loads nothing from another site.
* **Works with High-Performance Order Storage (HPOS)** and the block checkout.
* If the Advanced Shipment Tracking plugin is active, the tracking number is registered there as well.

= What it does not do =

* It does not change your checkout, your theme or your payment methods.
* It does not change stock or prices, in either direction.
* It does not cancel or refund orders. Do that in WooCommerce; the copy in SitesPlaced follows.

A free SitesPlaced account is enough to connect one shop. SitesPlaced is a separate service and is not affiliated with WooCommerce or Automattic.

== External services ==

This plugin connects your shop to SitesPlaced (https://sitesplaced.com), a service run by SitesPlaced. It is needed for everything the plugin does: without it there is nowhere to copy the orders to.

**Nothing is sent until you connect.** After you press "Connect to SitesPlaced" (or paste a key), the plugin talks to `https://sitesplaced.com/api/v1` from your server.

What is sent, and when:

* **When you connect, and once a day after that:** your site's address, your shop's name, its currency, the plugin version and the WooCommerce version, and the address on your site where shipping updates can be delivered.
* **Every time an order is created or changes, and when you import past orders:** the order number and status, payment method and payment status, totals, currency, the items (name, SKU, options, quantity, price, picture link), the customer note, the link to the order in your wp-admin, and the customer's name, email address, phone number and delivery address.
* **When a product is created, changed or deleted, and once for the whole catalogue after you connect (only while "Send products to SitesPlaced" is on):** product name, SKU, price, stock quantity, category, short description, picture links, product link and status.
* **Every 15 minutes:** a request asking whether any shipping updates are waiting, followed by a confirmation of the ones that were applied.
* **When you disconnect or delete the plugin:** a request that cancels this shop's key.

SitesPlaced also sends shipping updates to your site (`/wp-json/sitesplaced/v1/updates`). Each one is signed, and the plugin rejects anything that is not.

The shortcode and the tracking links send your shoppers to your store's tracking page on SitesPlaced only when they click. The plugin loads no scripts, fonts or images from SitesPlaced, and it does no tracking or analytics.

* Terms of service: https://sitesplaced.com/tos
* Privacy policy: https://sitesplaced.com/privacy

== Installation ==

1. Install and activate WooCommerce 7.0 or newer.
2. Upload the `sitesplaced-for-woocommerce` folder to `/wp-content/plugins/`, or install the zip from Plugins > Add New > Upload Plugin.
3. Activate the plugin.
4. Go to WooCommerce > SitesPlaced and press "Connect to SitesPlaced".
5. Sign in to SitesPlaced (or create a free account), check that the address shown is your shop, and approve. You come back to wp-admin, connected.

From then on new orders are copied automatically, and the last 30 days of orders are imported in the background.

If the connect button cannot be used on your site, open "Connect with a key instead", create the connection in your SitesPlaced dashboard, and paste the API key and the signing secret.

== Frequently Asked Questions ==

= Does it change my checkout? =

No. Nothing is added to the cart or the checkout, and no script runs on your shop's pages. Orders are sent from your server, in the background, after they are saved.

= Does it touch my stock? =

No. Stock, prices and products are only read. SitesPlaced never writes them back.

= What does SitesPlaced change in WooCommerce? =

Only shipping. When an order ships in SitesPlaced, the plugin saves the courier and tracking number on the WooCommerce order, adds an order note, and (if you leave the setting on) moves a Processing or On hold order to Completed. Cancelled, refunded and failed orders are never changed.

= How do I cancel or refund an order? =

In WooCommerce, as usual. The copy in SitesPlaced follows within moments. A cancelled or refunded order always wins over whatever SitesPlaced shows.

= What happens if I uninstall? =

Deactivating the plugin stops all background jobs and keeps your settings. Deleting the plugin cancels your shop's key at SitesPlaced, and removes the plugin's settings and scheduled jobs from WordPress. Tracking numbers already saved on your orders are kept, because they are part of your order history. Orders already copied to SitesPlaced stay there; you can remove that store from your SitesPlaced account.

= Can I use it on a staging copy? =

Yes, safely. A staging copy of your site carries the live shop's key in its database. The plugin notices that the site's address is no longer the one that was connected and pauses itself before sending anything, so test orders never reach your real SitesPlaced store. SitesPlaced checks the address too. You will see a notice in wp-admin. If you do want the staging site connected, press "Reconnect" there and choose a separate store for it in SitesPlaced (a free account covers one connected shop). Your live site is not affected either way.

= Sync is paused. What do I do? =

The notice tells you why. Either the key was cancelled in SitesPlaced (press "Reconnect"), or the site's address changed (if you moved your shop to a new domain, press "Reconnect"; if this is a copy, leave it paused). Orders placed while sync was paused are imported when it starts again.

= My site has WP-Cron switched off. Will it work? =

Yes, but orders may arrive late. Background jobs run through Action Scheduler, which also runs whenever someone opens wp-admin. For prompt syncing, set up a server cron job that calls `wp-cron.php` every minute. The settings screen tells you when jobs have been waiting too long.

= My host blocks the REST API. Will tracking still come back? =

Yes. Shipping updates are normally delivered to your site straight away. If that is blocked, the plugin collects them itself every 15 minutes.

= Does it work with custom order statuses and order number plugins? =

Yes. The order number your shoppers see is the one used in SitesPlaced, and an order with a custom status is treated as an open order.

= Which currencies and countries are supported? =

Any. The currency and the address are copied exactly as WooCommerce holds them.

= How are prices sent? =

Each item is sent at the price the shopper paid per unit, after coupons and before tax. Tax is sent as its own total. Developers can switch to tax-inclusive prices with the `spwc_unit_price_includes_tax` filter.

== Changelog ==

= 1.0.0 =
* First release: one-click connect, live order sync, import of past orders, product copy, shipping updates and tracking display, tracking shortcode, HPOS support.

== Upgrade Notice ==

= 1.0.0 =
First release.
