=== Lincah Shipping ===
Contributors: devlincahid, lincah
Tags: shipping, woocommerce, indonesia, courier, cod
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
WC requires at least: 8.0
WC tested up to: 9.8

Multi-courier shipping rates, COD support, order creation, tracking, and webhooks for Indonesian couriers — powered by Lincah.

== Description ==

**Lincah Shipping** integrates your WooCommerce store with the [Lincah](https://lincah.id) courier aggregator API, giving your customers access to real-time shipping rates from multiple Indonesian couriers at checkout.

= Features =

* **Multi-courier rates** — JNE, J&T, SiCepat, ID Express, Ninja, Lion Parcel, SAP, AnterAja, Pos Indonesia, and more.
* **COD support** — Automatically shows COD-eligible couriers when customers choose Cash on Delivery.
* **Province / City / District dropdowns** — Cascading address selectors powered by Lincah location data replace the default WooCommerce address fields for Indonesia.
* **Multiple shipping origins** — Configure multiple warehouses or stores; products can ship from different origins.
* **Automatic shipment creation** — Orders are automatically pushed to Lincah when payment is received.
* **Tracking & webhooks** — Receive real-time status updates from couriers via webhooks; tracking info displayed on admin and customer order pages.
* **WooCommerce Blocks support** — Full compatibility with the block-based checkout (Cart & Checkout blocks).
* **HPOS compatible** — Fully compatible with WooCommerce High-Performance Order Storage.

= How It Works =

1. Sign up at [lincah.id](https://lincah.id) and get your API credentials.
2. Install and activate the plugin.
3. Enter your API Token and Partner ID in **WooCommerce → Lincah Shipping**.
4. Add at least one shipping origin (warehouse/store).
5. Add the Lincah Shipping method to a WooCommerce Shipping Zone.
6. Customers will see real-time courier rates at checkout.

== External services ==

This plugin connects to the **Lincah API** (`https://api.lincah.id/openapi` and sandbox `https://dev-api.lincah.id/openapi`) to provide shipping functionality.

What the service is used for:
- Fetching province/city/district location data used in checkout selectors.
- Fetching courier and service availability/rates.
- Creating shipment orders after checkout/payment.
- Tracking shipment status and handling shipment updates.

What data is sent and when:
- During shipping-rate requests: origin/destination location codes, shipment type (regular/COD), selected courier/service, and package details (weight/quantity/value context).
- During shipment creation/tracking/cancel operations: order shipping recipient info (name, phone, address/district), selected courier/service, and order shipping metadata required by the API.
- During account/API checks from admin settings: configured API credentials (API token and partner ID) are used to authenticate API calls.

Service provider legal pages:
- Terms and Conditions: https://lincah.id/syarat-dan-ketentuan/
- Privacy Policy: https://lincah.id/kebijakan-privasi/

== Source code and build ==

This plugin includes both built assets and their editable source files.

- Built checkout blocks asset: `assets/build/checkout-blocks.js`
- Editable source file (included in plugin package): `src/checkout-blocks/index.js`
- Build tooling config (included in plugin package): `package.json` (`@wordpress/scripts`)
- Build command used to regenerate assets: `npm run build`

License note:
- Plugin code is distributed under GPLv2 or later.
- Third-party code bundled in this plugin remains under its respective compatible licenses.

== Installation ==

1. Upload the `lincah-shipping` folder to the `/wp-content/plugins/` directory, or install through the WordPress plugin screen.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Navigate to **WooCommerce → Lincah Shipping** to configure your API credentials.
4. Add at least one shipping origin under the **Origins / Warehouses** tab.
5. Go to **WooCommerce → Settings → Shipping** and add the **Lincah Shipping** method to the appropriate shipping zone.

== Frequently Asked Questions ==

= Do I need a Lincah account? =

Yes. You need to register at [lincah.id](https://lincah.id) to obtain an API Token and Partner ID. A sandbox mode is available for testing.

= Which couriers are supported? =

Lincah supports all major Indonesian couriers including JNE, J&T Express, SiCepat, ID Express, Ninja Express, Lion Parcel, SAP Express, AnterAja, and Pos Indonesia. The available couriers depend on your Lincah account.

= Does this plugin support COD (Cash on Delivery)? =

Yes. When a customer selects COD as the payment method, the plugin automatically fetches COD-eligible courier rates.

= Can I have multiple shipping origins? =

Yes. You can configure multiple warehouses or stores as shipping origins. Each product can be assigned to a specific origin, and shipping rates are calculated per origin.

= Does it work with WooCommerce Blocks checkout? =

Yes. The plugin fully supports both the classic and block-based WooCommerce checkout.

= What happens when an order is placed? =

When an order is paid, the plugin automatically creates a shipment in Lincah. You can also manually create, track, or cancel shipments from the WooCommerce order edit screen.

= How do I secure the webhook endpoint? =

Set a **Webhook Secret** in **WooCommerce → Lincah Shipping**. Your webhook sender must send the same secret in one of these:
- `X-Lincah-Webhook-Secret` header (recommended), or
- `X-Webhook-Secret` header, or
- `Authorization: Bearer your_webhook_secret`.

Requests with missing/invalid secret are rejected.

== Screenshots ==

1. Plugin settings page — API configuration and general settings.
2. Origins / Warehouses management — add and manage shipping origins.
3. Checkout — province, city, and district dropdown selectors.
4. Checkout — multi-courier shipping rate display.
5. Order admin — Lincah shipping meta box with tracking info.

== Changelog ==

= 1.0.3 =
* Harden cached manifest validation, filter short-circuit behavior, metadata validation, and redirect handling.

= 1.0.2 =
* Pin checksum verification to the exact immutable package URL offered by WordPress.

= 1.0.1 =
* Add a secure self-hosted update distribution channel for non-WordPress.org installations.

= 1.0.0 =
* Initial release.
* Multi-courier rate calculation via Lincah API.
* COD support with automatic rate filtering.
* Province / City / District cascading dropdowns at checkout.
* Multiple shipping origins with per-product assignment.
* Automatic shipment creation on order payment.
* Tracking info display on admin and customer order pages.
* Webhook handler for real-time courier status updates.
* WooCommerce Blocks checkout support.
* HPOS (High-Performance Order Storage) compatibility.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
