=== Sendcloud | Shipping & Dynamic Checkout Automation for WooCommerce ===
Contributors: sendcloudbv
Tags: shipping, dynamic checkout, service point, delivery, woocommerce
Stable tag: 1.0.2
Requires Plugins: woocommerce
Requires PHP: 7.4
Requires at least: 6.5
Tested up to: 7.1
WC requires at least: 9.5
WC tested up to: 9.5
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Easily integrate Dynamic Checkout and shipping automation into your WooCommerce store with Sendcloud.

== Description ==

**Sendcloud is the all-in-one shipping platform for e-commerce growth.**

Speed up your logistics, optimize your checkout, and offer a smooth post-purchase experience — all without writing a single line of code.

Whether you're shipping orders, our WooCommerce plugin helps you:

- Offer **dynamic delivery options** in your checkout (standard, same-day, nominated day, service points)
- **Display real-time delivery estimates** based on carrier, location, and cut-off times
- Let customers **choose service points** directly via map or list view

= Key Features =

** Dynamic Checkout Experience**
- Offer multiple delivery methods with custom pricing and cut-off times
- Configure options directly from the Sendcloud Panel
- Automatically display the best method per customer and product context

** Service Point Delivery**
- Let customers select service points via interactive map or list
- Compatible with major European carriers (e.g. DHL, DPD, bpost, PostNL, Colissimo)
- Postal code and Post Number (DHL Germany) validations built in

** Seamless API Integration**
- Communicates directly with Sendcloud’s Checkout API out of the box
- Basic Authentication for secure setup

** Compatible & Extendable**
- Works with WooCommerce blocks and checkout plugins
- Fully translatable (EN, NL, DE, FR, ES, IT)
- Developer-friendly metadata storage for order exports and APIs

== Installation ==

1. Install the plugin through the **Plugins > Add New** menu in WordPress or upload it manually to `/wp-content/plugins/sendcloud-checkout`.
2. Activate the plugin through the ‘Plugins’ screen.
3. Connect your Sendcloud account using your public/private API key.
4. In the Sendcloud Panel, create your **Dynamic Checkout Configuration**.
5. Return to WordPress and configure the plugin by entering your **Public and Secret keys**.
6. Save and test your checkout flow.

== Frequently Asked Questions ==

= Do I need a Sendcloud account? =
Yes. You'll need to [sign up for Sendcloud](https://www.sendcloud.com) to use this plugin.

= What is a Post Number, and when is it required? =
For **Germany** shipments using **DHL Service Point**, customers must enter a 9-digit Post Number (used by DHL Packstations).

== External services ==

This plugin connects to the Sendcloud API and loads a Sendcloud script to provide dynamic checkout delivery options and service point selection. Both are operated by Sendcloud B.V. A Sendcloud account and your Sendcloud public/secret API keys are required for these features to work.

1. Sendcloud Checkout / Delivery Options API

- Endpoint: https://panel.sendcloud.sc/api/v3/checkout/delivery-options
- What it is used for: retrieving the dynamic delivery options (e.g. standard, same-day, nominated day, service point) configured in your Sendcloud Dynamic Checkout configuration.
- When data is sent: server-side from your store, when the checkout block loads and delivery options need to be fetched.
- What data is sent: the cart's total weight, the order total (price), the store's origin country code, and the customer's destination (shipping) country code. The request is authenticated with your Sendcloud public/secret API keys (HTTP Basic authentication).

2. Sendcloud Service Point Picker script

- Script: https://embed.sendcloud.sc/spp/1.0.0/api.min.js
- What it is used for: rendering the interactive service point (pickup point) selector — a map and list of nearby service points the customer can choose from.
- When data is sent: the script is loaded in the customer's browser on the checkout page when a service point delivery method is shown, and it contacts Sendcloud when the customer opens the picker to look up nearby service points.
- What data is sent: your Sendcloud public API key and the customer's shipping address details used to locate service points — country, postal code, city and street address — together with the selected display language and the eligible carrier codes.

Use of these services is subject to Sendcloud's legal terms:

- Terms & Conditions: https://www.sendcloud.com/terms-conditions/
- Privacy Policy: https://www.sendcloud.com/privacy-policy/

== Changelog ==

= 1.0.2 =
* Hardened the order confirmation, admin order details, and order email templates against incomplete or malformed checkout payload data
* Delivery method, carrier, service point address, PO box number, and delivery date sections are now omitted when the underlying data is absent, instead of rendering empty values
* Removed a redefinition of the WordPress core ARRAY_A constant
* Added a runtime order object check on the WooCommerce thank you page before reading order meta
* Fixed malformed markup in the order confirmation and order email templates
* Removed local development configuration files from the release package
* Added an automated packaging check that prevents development files from being included in future releases

= 1.0.1 =
* Changed API request body format
* Remove configuration id parameter

= 1.0.0 =
* Introduced new plugin architecture for Dynamic Checkout support
* Replaced deprecated Dynamic Checkout methods with official API-based configuration
* Added full support for standard, same-day, and nominated day delivery options
* Improved service point selection UX and fallback logic
* New support for Checkout metadata and delivery option storage
* Plugin now stores selected delivery metadata in order and exposes it to WooCommerce REST API
