=== Noti for WooCommerce ===
Contributors: wpnoti
Tags: woocommerce, orders, notifications, analytics, mobile
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 0.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect a WooCommerce store to the WPNoti mobile app.

== Description ==

Noti for WooCommerce connects this WooCommerce store to the [WPNoti](https://wpnoti.com) mobile app so the merchant can see orders, products, and store activity.

The plugin runs the same way on every connected store. The app’s Pro plan is billed by WPNoti, outside WordPress. Creating an account is free.

Nothing is sent until a store manager presses Connect under WooCommerce → Noti.

== Source code ==

The files in this plugin are the source. `assets/beacon.js` is the readable visitor script. It is not a build output, and the plugin has no compile step.

== External services ==

This plugin uses WPNoti (https://wpnoti.com), a service run by the plugin author.

* Terms of use: https://wpnoti.com/terms-of-service
* Privacy policy: https://wpnoti.com/privacy-policy

**When a store manager presses Connect**

The plugin sends this site’s URL, store name, currency, timezone, and the WordPress, WooCommerce, PHP, and WPNoti versions, together with a site token, to https://wpnoti.com/api/pair/init.

**After the store is connected**

The plugin sends events to the ingest address WPNoti returns during pairing:

* Order summary: order number, status, total, currency, item count, payment method, and buyer name.
* Form notice: form title, page URL, and a short preview from Contact Form 7, WPForms, Gravity Forms, and other supported forms. The full submission is stored encrypted on this site.
* Store error: fatal PHP message, file path, and line, plus checkout and server-error notices for cart and checkout.
* New administrator or shop manager: login name, email address, role, and who made the change, including accounts added directly in the database.
* Disconnect: a site-deactivated notice when the plugin is deactivated or deleted.

**Approving store edits**

When the store connects, the settings screen shows a third step: approve store edits. That step opens WooCommerce’s own approval screen. WooCommerce creates the REST API key and sends it to WPNoti. Until that approval, the app can only read the store. The merchant can revoke the key under WooCommerce → Settings → Advanced → REST API.

Disconnecting the store deletes that WooCommerce API key on this site. WPNoti deletes its stored copy of the key.

The plugin does not contain write routes, and it does not create the API key itself.

The connected app also calls this site with the site token for data WooCommerce does not provide: plugin health, stored form and error events, and visitor counts. Those calls can also read orders and products so the app can show them. They cannot change orders, products, coupons, customers, users, or WordPress settings.

**Visitors**

Visitor counts are off until a shop manager turns on “Count store visitors” in WooCommerce → Noti. Until then the beacon does not load and the `noti_vid` cookie is not set. When the setting is on, the plugin sets a first-party cookie named `noti_vid`. It lasts 180 days. The value is a random identifier for unique visitors and page views. It is not used for advertising. The plugin stores a hash of that identifier and the page path on this site. The beacon does not run for logged-in editors. When a consent plugin is detected, the beacon does nothing until consent is given. Block it with the `noti_tracking_allowed` filter. The app reads visitor counts from this site when that screen is opened.

== Installation ==

1. Install WooCommerce 8.0 or newer, then install Noti for WooCommerce from Plugins → Add New.
2. Activate Noti for WooCommerce.
3. Open WooCommerce → Noti and create an account, or sign in.
4. Enter the pairing code in the WPNoti dashboard or app.
5. Complete the “Approve store edits” step. WooCommerce asks you to allow the app to change orders and products.

== Frequently Asked Questions ==

= Does the plugin work without an account? =

Connecting the store needs a free WPNoti account. Until then, the plugin does not send orders, forms, errors, visitor counts, or any request to wpnoti.com.

= Where is visitor data stored? =

Visitor counts stay on this site, and only after “Count store visitors” is turned on. The beacon then sets the `noti_vid` cookie described above. The app reads those counts when a signed-in user opens the visitors screen. If the setting is off, the app says to turn on visitor counts in WordPress.

= Where do form messages stay? =

The full submission is stored encrypted on this site. WPNoti receives a short preview. The app can retrieve the full submission when someone opens that event.

== Changelog ==

= 0.1.1 =
* After a store connects, approving order and product edits is the next setup step.
* Send one push per new order when checkout runs more than one order hook.
* Record live visitors when the beacon posts as plain text.

= 0.1.0 =
* Initial release.
