=== ShipBG for WooCommerce ===
Contributors: sksoft
Tags: shipping, woocommerce, courier, delivery, bulgaria
Requires at least: 5.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Multi-carrier shipping for WooCommerce — Speedy, Econt, BoxNow, Sameday & PostOne with live rates, labels and tracking.

== Description ==

ShipBG for WooCommerce integrates your WooCommerce store with the ShipBG shipping platform, providing access to multiple Bulgarian courier services through a single plugin.

Connect Speedy (Спиди), Econt (Еконт), BoxNow, Sameday and PostOne to your store and offer real-time shipping rates (доставка), automatic waybills (товарителници), pickup-point and locker selection, and shipment tracking — all from one WooCommerce plugin.

**Features:**

* **Multi-carrier aggregation** — Speedy, Econt Express, PostOne, BoxNow, Sameday, A1 Post, BG Post in one plugin
* **Live shipping rates** — Real-time rate calculation from all carriers at checkout
* **Smart pickup point search** — Typo-tolerant search with interactive map picker
* **Shipment management** — Create shipments, generate labels, and track packages from WooCommerce admin
* **Bulk operations** — Batch label generation for multiple orders
* **Customer tracking** — Tracking timeline widget on My Account page
* **Webhook support** — Auto-registered endpoint with HMAC signature verification for real-time status updates
* **Returns** — Initiate return shipments from admin
* **COD support** — Automatic cash-on-delivery amount mapping
* **Block checkout** — Full support for WooCommerce Blocks checkout via React components
* **Classic checkout** — jQuery-based delivery type selector and pickup point map
* **HPOS compatible** — Uses WooCommerce CRUD methods, no direct postmeta access
* **Setup wizard** — Step-by-step onboarding to connect your ShipBG account and configure carriers
* **Flexible carrier overrides** — Per-carrier configurable settings and pricing rules

**Requirements:**

* WordPress 5.0 or higher
* WooCommerce 8.0 or higher
* PHP 7.4 or higher
* A ShipBG account with API credentials

**External Service Usage:**

This plugin relies on the following external services:

1. ShipBG API (https://shipbg.com/api/v1) — Required. This is the core backend the plugin is an integration for.

What it's used for: Real-time shipping rate calculation, shipment creation, label generation, shipment tracking, pickup-point search, address autocomplete/geocoding, and OAuth-based account connection.

What data is sent, and when:
* Order details, customer shipping address (name, street, city, postcode, country, phone, email), and parcel dimensions/weight are sent whenever the merchant calculates rates at checkout or creates a shipment from the admin order screen.
* Free-text address queries are sent when a customer uses the pickup-point map or address autocomplete at checkout.
* Shipment IDs are sent when the merchant refreshes tracking status.
* A store-identifying OAuth token is sent with every request (configured once during setup).

Terms of Service: https://shipbg.com/terms-and-conditions
Privacy Policy: https://shipbg.com/privacy-policy

A ShipBG account with API credentials is required for the plugin to function.

2. OpenStreetMap tile server (https://{s}.tile.openstreetmap.org/) — Browser-side only.

What it's used for: Rendering the pickup-point selection map on the classic WooCommerce checkout page (via Leaflet).

What data is sent, and when: Only the customer's browser requests map tiles. Each request contains the tile coordinates (z/x/y) the map needs to render the visible area. No personal data, order data, or plugin-specific data is sent.

Terms of Service: https://operations.osmfoundation.org/policies/tiles/
Privacy Policy: https://wiki.osmfoundation.org/wiki/Privacy_Policy

== Installation ==

1. Upload the `shipbg-for-woocommerce` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to WooCommerce > Settings > Shipping > ShipBG to configure your API credentials.
4. Enable the ShipBG shipping method in your WooCommerce shipping zones.

== Frequently Asked Questions ==

= Do I need a ShipBG account? =

Yes, you need an active ShipBG account with API credentials. Visit [shipbg.com](https://shipbg.com) to create one.

= Which carriers are supported? =

ShipBG supports multiple Bulgarian courier services including Speedy, Econt, Sameday, BoxNow, PostOne, A1 Post, BG Post. The available carriers depend on your ShipBG account configuration.

= Does this plugin support WooCommerce Blocks checkout? =

Yes, the plugin fully supports both the classic WooCommerce checkout and the newer Blocks-based checkout.

== Changelog ==

= 1.6.1 =
* Fixed: the order delivery-type label now reflects your per-carrier "Send From" setting. Merchants who drop parcels at a carrier office (Send From = Office) previously saw orders labelled "Door to Office"; they now correctly show "Office to Office" (or "Office to Door"). The sender side follows your carrier configuration instead of a hardcoded "Door". This was a label-only issue — the actual sender office was already used when creating the shipment.

= 1.6.0 =
* Persistent "Close & don't show again" on advisory admin notices: the wrong-location shipping-calc banner, the checkout-fields health notice, and the sender-address-incomplete notice can now be dismissed for good instead of reappearing on every admin page.
* Smart re-show: the checkout-fields and sender notices re-surface if a new or different issue appears, so a dismissed notice never hides a fresh problem. Live alerts (API unreachable, WooCommerce inactive) remain non-dismissable.

= 1.5.0 =
* Real-time tracking webhooks: the plugin now auto-registers a webhook subscription with ShipBG on connect (no manual step) and receives pushed shipment/tracking updates instead of relying on polling.
* Order updates on delivery events: shipment status, tracking timeline, and order notes are written from the pushed events; the order is matched by its ShipBG shipment id.
* Hardened inbound webhook verification: signatures are validated with a timestamped HMAC scheme and a replay window.

= 1.4.0 =
* Headless / custom-theme checkout support: two filters (`shipbg_checkout_mode`, `shipbg_render_checkout_ui`) let a theme consume ShipBG as a pure data layer without rendering the plugin's own checkout UI.
* Granular checkout rates now carry the resolving courier account, so order meta records the correct carrier account id even on themed checkouts.

= 1.0.0 =
* Initial release.
* Multi-carrier shipping rate calculation.
* Shipment creation and tracking.
* Pickup point selection.
* Bulk operations support.
* Webhook status updates.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
