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

WooCommerce shipping for Bulgaria: live rates, pickup map, labels and tracking for Speedy, Econt, Pigeon, BoxNow, Sameday and PostOne.

== Description ==

ShipBG connects your WooCommerce store to the Bulgarian courier accounts you already use.

You connect your own carrier accounts, and the plugin brings live delivery prices, pickup-point selection, waybill creation, label printing and tracking into WooCommerce.

Supported carriers:

* Speedy
* Econt
* Pigeon
* BoxNow
* Sameday
* PostOne

**Main features:**

* **Live rates in checkout** — show delivery prices from your connected carriers for address, office or locker delivery.
* **Pickup-point map and search** — customers choose offices and lockers directly in checkout, with typo-tolerant search.
* **No extra checkout clutter** — ShipBG works with the normal WooCommerce address flow and suggests nearby pickup points when possible.
* **Waybills from the order screen** — create shipments without copying order data into carrier portals.
* **PDF and ZPL labels** — print one label or generate labels in bulk for many orders.
* **COD support** — send cash-on-delivery details to supported carriers while payouts stay under your own carrier contract.
* **Tracking updates** — sync shipment statuses back to WooCommerce and show customers a tracking timeline.
* **Returns and cancellation** — start returns or cancel shipments from WooCommerce where the carrier supports it.
* **Flexible delivery pricing** — set free-shipping thresholds, fixed prices or merchant subsidies by carrier, delivery type, order value or weight.
* **Checkout resilience** — optional merchant-configured fallback rates can keep checkout available during temporary API or carrier outages.
* **Classic and Blocks checkout** — supports both WooCommerce checkout experiences.
* **HPOS compatible** — uses WooCommerce order APIs, not direct postmeta writes.

**Requirements:**

* WordPress 5.0 or higher
* WooCommerce 8.0 or higher
* PHP 7.4 or higher
* A ShipBG account
* Your own account or contract with each carrier you want to enable

**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, returns, cancellation and 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, downloads a label, cancels a shipment or starts a return.
* 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 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. Open the ShipBG setup wizard and connect your store to your ShipBG account.
4. Add the carrier accounts you want to use.
5. Enable the ShipBG shipping method in your WooCommerce shipping zones.

== Frequently Asked Questions ==

= Do I need a ShipBG account? =

Yes. The plugin connects WooCommerce to the ShipBG API, so an active ShipBG account is required.

= Do I need my own carrier contracts? =

Yes. ShipBG connects your existing carrier accounts. You keep your own Speedy, Econt, Pigeon, BoxNow, Sameday or PostOne account/contract, and the carrier invoices or pays you directly under that relationship.

= Which carriers are supported? =

ShipBG currently supports Speedy, Econt, Pigeon, BoxNow, Sameday and PostOne. The exact carriers available in checkout depend on which accounts you connect and enable.

= Does this plugin support WooCommerce Blocks checkout? =

Yes. ShipBG supports both classic checkout and WooCommerce Blocks checkout.

= Does ShipBG handle COD payouts? =

No. COD is sent to the supported carrier as part of the shipment request. The carrier pays you directly according to your own carrier contract.

= What happens if a carrier or API is temporarily unavailable? =

The plugin can show an optional fallback delivery rate configured by the merchant, so customers can still complete checkout. Fallback rates are clearly separate from live carrier quotes.

== Screenshots ==

1. Live address-delivery rates in WooCommerce Blocks checkout.
2. Smart office and locker selection directly in checkout.
3. Carrier routing by delivery type.
4. Shipment creation from the WooCommerce order screen.
5. Tracking status and events after a shipment is created.
6. Pricing rules and ready-made templates.

== Changelog ==

= 1.7.5 =
* Adds a checkout exposure summary before finishing setup.
* Adds direct setup links to carrier settings, pricing rules, and carrier routing.
* Aligns sender and checkout setup wording between the wizard and carrier settings.

= 1.7.4 =
* Added Pigeon carrier support.
* Updated carrier settings and defaults flow.

= 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.
