=== Postage for WooCommerce ===
Contributors: postage
Tags: shipping, woocommerce, shipping labels, shipping rates
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 8.0
WC requires at least: 8.0
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Quote and sell Postage shipping rates at checkout, and buy real shipping labels for your WooCommerce orders from your Postage account balance.

== Description ==

This plugin connects a WooCommerce store to your Postage account (via a personal access token — create one under your Postage account's API Tokens page) and adds two independent, opt-in capabilities:

1. **Live rates at checkout** — a "Postage" shipping method that quotes real Postage rates for the shopper's cart and offers each as a selectable delivery option, added to any shipping zone under WooCommerce → Settings → Shipping.
2. **Buy the actual label** — once an order exists, buy a real Postage shipping label for it: either by clicking "Buy Postage label" on the order screen, or automatically when the order reaches a status you choose (e.g. Processing). The tracking number and a downloadable label appear on the order once Postage has bought it.

A third, independent capability:

3. **Shipping Label product** — flag any simple product as a Postage label product (checkbox in the Product Data → General tab). Instead of a fixed price, shoppers get a live quote form (destination + weight); the exact label they pick is bought automatically once their order is paid, and they can download it from their order confirmation / My Account page.

Every API call this plugin makes is tagged so your Postage account can tell it apart from other API usage.

= Requirements =

* WooCommerce 8.0+
* A Postage account with a personal access token granting the `rates:read`, `carts:write`, `orders:read` and `orders:write` abilities
* PHP 8.0+

= Webhooks (recommended) =

Buying a label is asynchronous on Postage's side. For the fastest, most reliable status updates, add this plugin's webhook URL (shown on the Postage settings screen) to your Postage account under Account → Webhooks, subscribed to `order.completed` and `tracking.updated`, and paste the signing secret into the plugin's settings. Without this, use the "Check status" button on the order screen instead.

== Installation ==

1. Upload the `postage-woocommerce` folder to `/wp-content/plugins/`, or install the zip via Plugins → Add New → Upload Plugin.
2. Activate the plugin.
3. Go to the "Postage" menu, enter your Postage site URL and API token, and enable the features you want.
4. If you enabled live rates at checkout, add the "Postage" method to a shipping zone under WooCommerce → Settings → Shipping.

== Changelog ==

= 1.0.1 =
* Fixed: parcels were under-weighed when a product had no weight set. A weightless product now assumes the default weight per unit, instead of contributing nothing unless the whole order weighed zero.
* Fixed: fractional line quantities (from a sell-by-weight / decimal-quantity extension) are no longer truncated when weighing the parcel.
* Changed: the default package weight must now be at least 0.1 oz — 0 quoted a weightless parcel.
* Fixed: the feature checkboxes could not be turned off — saving the settings form silently switched them back on.
* Fixed: settings not shown on the form (e.g. the default package type) were reset on every save.
* Fixed: webhooks never updated Shipping Label product items, which record the Postage order id on the order item rather than the order. They now pick up their tracking code and label like any other purchase.
* Fixed: "Check status" reported success without changing anything when an order had a tracking code but no label yet.
* Removed: the "Test mode" checkbox, which never did anything. Sandbox vs live depends only on whether you paste a Test or Live token.

= 1.0.0 =
* Initial release: live checkout rates, order label purchase (manual + auto), Shipping Label product type, webhook-driven status updates.
