=== Sunduqz Locker Delivery ===
Contributors: abdulmotalebalhajj
Tags: woocommerce, shipping, locker, delivery, checkout
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 7.9
WC tested up to: 9.4
Stable tag: 3.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds a Sunduqz smart-locker pickup option to WooCommerce checkout, for both Classic and Block Checkout, with no extra configuration.

== Description ==

Sunduqz Locker Delivery lets your WooCommerce customers choose to pick up their order from a Sunduqz smart locker instead of a home delivery address. The plugin adds a locker picker to your store's checkout page and automatically detects whether your store uses Classic (shortcode) or Block Checkout, so it works without any additional setup once connected.

**Features**

* Locker picker on checkout (Classic and Block Checkout, detected automatically)
* Locker details and driver pickup OTP attached to each order
* Order note and admin order screen display of the selected locker and OTP
* Customizable button colors and sizes from the WordPress admin
* Webhook notification to Sunduqz when a new order is placed

= External services =

This plugin connects to the Sunduqz platform (a smart-locker delivery network) to function:

* **Store connection** — when you enter your WooCommerce REST API key on the Sunduqz Connection settings screen, the plugin sends your store URL, store name, and that REST API key to `https://api.sunduqz.com/woocommerce/register` to verify you control the store and link it to your Sunduqz account.
* **Locker map** — the checkout locker picker loads an iframe from `https://map-picker-widget.sunduqz.com/` so customers can browse and select a nearby locker.
* **Order webhook** — when a customer places an order with a locker selected, the order details (locker location, customer info required for delivery, and a driver pickup code) are sent to Sunduqz's servers at `https://api.sunduqz.com/webhooks/woocommerce-order` so the order can be routed to the correct locker.
* **Driver OTP generation** — at order-creation time, the plugin requests a one-time pickup code from `https://api.sunduqz.com/woocommerce/generate-driver-otp`.

No data is sent to Sunduqz until you connect your store from the plugin's settings screen. See Sunduqz's terms of service and privacy policy at [https://about.sunduqz.com](https://about.sunduqz.com).

= Support =

For help with this plugin, contact support@sunduqz.com or visit [https://about.sunduqz.com](https://about.sunduqz.com).

== Installation ==

1. Upload the plugin through Plugins → Add New → Upload Plugin, or extract it into `wp-content/plugins/`.
2. Activate the plugin through the "Plugins" screen.
3. Go to Sunduqz → Connection in wp-admin.
4. Generate a WooCommerce REST API key (Read/Write) at WooCommerce → Settings → Advanced → REST API, and paste it into the Connection screen to link your store.
5. The locker picker will now appear at checkout automatically.

== Frequently Asked Questions ==

= Does this work with Block Checkout? =

Yes. The plugin detects whether your Checkout page uses Block Checkout or the classic shortcode checkout and adjusts automatically — no configuration needed.

= Do I need to set up a shipping zone for Sunduqz? =

No. Locker selection is captured independently of whatever shipping method your store already uses.

= What happens if I deactivate the plugin? =

The plugin removes its webhook registration and disconnects your store from Sunduqz on deactivation.

== Changelog ==

= 3.0.0 =
* Merged Block Checkout support into the plugin — one plugin now serves both Classic and Block Checkout automatically.
* Server-side driver OTP generation, tied to actual order creation.
* Connection flow now uses a merchant-supplied WooCommerce REST API key instead of a bundled secret.

= 2.0.0 =
* Consolidated settings into a single Sunduqz admin menu.
* Added customizable button colors and sizes.

== Upgrade Notice ==

= 3.0.0 =
Adds Block Checkout support. If you previously used a separate Sunduqz Blocks plugin, its settings are migrated automatically.
