=== Transdirect Shipping Plugin for Woocommerce ===
Contributors: transdirect, bywave
Tags: shipping, woocommerce, courier, freight, australia
Requires at least: 4.2
Tested up to: 7.0
Stable tag: 9.0.0
Requires Plugins: woocommerce
WC requires at least: 7.1
WC tested up to: 10.5
Requires PHP: 7.4
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

This plugin provides delivery quotes from Australia's largest carriers in a seamless checkout process.

== Description ==

The Transdirect Shipping Plugin for WooCommerce connects your store with Australia's largest courier and freight providers. It enables your customers to receive real-time shipping quotes and choose from multiple delivery options directly at checkout.

**Requires [WooCommerce](https://wordpress.org/plugins/woocommerce/) 7.1 or later.**

The main features of this plugin are:
- Free to use.
- Easy to configure and manage.
- Great shipping rates from Toll Ipec, Fastway, Couriers Please, Toll Priority, Northline and more.
- Seamless quote integration in the cart and checkout.
- Multiple delivery options.
- Optional insurance support.
- Automatic order sync (if enabled).

To learn more or request an API key, please contact [sales@transdirect.com.au](mailto:sales@transdirect.com.au). 
Transdirect — Delivering Solutions.

== Installation ==

This section describes how to install the plugin and get it working.

**Before you begin:** Make sure [WooCommerce](https://wordpress.org/plugins/woocommerce/) (7.1 or later) is installed and activated.

= Automatic installation =

1. Log in to your WordPress admin panel.
2. Go to **Plugins → Add New**.
3. Search for "Transdirect Shipping".
4. Click **Install Now**, then **Activate**.

= Manual installation =

1. Download the plugin ZIP from the source.
2. Unzip it and upload the folder to `/wp-content/plugins/` via FTP.
3. Log in to your WordPress admin, go to **Plugins**, and click **Activate**.

For detailed instructions, visit [the WordPress plugin installation guide](https://wordpress.org/support/article/managing-plugins/#manual-plugin-installation).

= Updating =

Updates are automatic. As always, back up your site before applying updates.

= Plugin Setup =

1. In your WordPress admin, go to **WooCommerce → Settings → Shipping → Transdirect**.
2. Enter your **API Key** (provided by Transdirect) and any other plugin-level options. These apply across every shipping zone.
3. Go to **WooCommerce → Settings → Shipping → Shipping zones** and open the Australia zone (or create one).
4. Click **"Add shipping method"** and select **"Transdirect Shipping"**.
5. The new shipping method has no per-zone settings — it simply enables Transdirect quotes for that zone using the global API key.
6. Optional plugin-level settings:
   - Enable **Debug Mode** to log Quotes, Order syncs and Product syncs.
   - Enable the **Residential / Commercial selector** to give customers a choice in the cart and set the default.
   - Adjust the **Quote API Timeout**.
7. To test shipping quotes:
   - Add a product to the cart.
   - Use the built-in WooCommerce **Shipping Calculator**.
   - Enter **Country**, **Suburb**, and **Postcode**, then click **Calculate Shipping**.
   - Transdirect quotes will be displayed; select one to proceed.
   - On the **Checkout page**, quotes will appear once a valid address is entered.
9. If **Order Sync** is enabled in your Transdirect account, new orders will be automatically synced.
10. For full setup instructions and advanced configuration, visit: [https://www.transdirect.com.au/members/api/apimodules](https://www.transdirect.com.au/members/api/apimodules)

== Changelog ==

= 9.0.0 =
**New for merchants**
* Global **Transdirect Shipping** settings page at WooCommerce → Settings → Shipping → Transdirect. Configure your API key, timeout, delivery-time display, debug mode and cart options once for the whole store. Per-zone API keys are gone — one key per install.
* "Settings" link next to Transdirect Shipping on the Plugins listing page so the configuration is one click away.
* Per-product **Boxes per unit** field on Product → Shipping (and per variation) for products that ship as multiple cartons. Cart quantity is multiplied by this value when requesting quotes, so a 4-box set quotes as 4 packages automatically.
* API key validation on save: if Transdirect rejects the key, an admin notice tells you straight away.
* Daily refresh of the bundled Australian suburb/postcode list from Transdirect, so locality data stays current.

**New for customers (opt-in)**
* **Suburb autocomplete** at cart and checkout: type a postcode or suburb and pick from a dropdown of the actual Transdirect locality table. Fills both the postcode and city fields. Enable under the new settings page → Cart & checkout.
* **Force selection from list** option that rejects free-typed cities at checkout so you only ship to recognised AU localities.
* **Residential / Commercial** selector at the cart and checkout. Pick a default of Residential, Commercial, the Transdirect account default, or **Force customer to pick** (no rate appears until the customer chooses).
* Standalone "Transdirect Shipping" widget on the cart page (Block Cart and Classic Cart). Combined postcode/suburb typeahead + optional residential/commercial radios + a Get a Quote button. Customers see rates without leaving the cart.

**Behaviour changes**
* The customer's residential/commercial choice now flows through to the Transdirect booking sync. Previously the account default was sent regardless of what the customer picked.
* The configured "Quote Display" mode on the Transdirect portal is now honoured (display cheapest, cheapest + fastest, or all). In reduced modes the carrier label is replaced with your custom Shipping Title when set.
* When a product is missing dimensions or weight, the Transdirect account's Default Item Size is used as a fallback so quotes still run.
* The legacy custom checkout-section heading override (driven by the API's shipping_title) has been removed — the WC default "Shipping options" heading is shown in full-quote mode.

**Upgrade**
* Existing API keys stored on a zone shipping method are automatically lifted into the new global setting on first load. A one-time admin notice asks you to verify before placing orders.
* `qty_in_pkg` product meta from the legacy "Transdirect Shipping Revision" plugin carries over with zero migration — same meta key.

**Under the hood**
* Failed order syncs now retry with exponential backoff instead of being permanently abandoned after 5 attempts.
* Fixed a crash that could exhaust PHP memory when admin pages instantiated multiple Transdirect shipping methods.
* Fixed Block Cart 400 errors during in-progress totals recalculation.
* Tested with WooCommerce up to 10.5 and PHP 7.4+.

= 8.0.3 =
* Added support for the new WooCommerce Block Checkout (in addition to the Classic Checkout).
* Shipping type selection (e.g. Parcel, Satchel) now works correctly on both checkout styles.
* Fixed an issue where checkout could proceed without a shipping method selected.
* Improved compatibility with newer versions of PHP, WooCommerce, and WordPress Multisite.
* Tested with WooCommerce up to 10.5.

= 8.0.2 =
* Bug fixes and general improvements

== Screenshots ==

1. How to navigate to Transdirect Shipping option under Shipping settings.
2. Example screenshot of Transdirect Shipping settings.
