=== Dopravio ===
Contributors: dopravio
Tags: woocommerce, shipping, carrier, orders, logistics
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.2
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Picks the cheapest carrier for every WooCommerce order and assigns it in the admin. No checkout changes, no shipping method added to the cart.

== Description ==

Dopravio compares your own negotiated carrier rates for every incoming order and
assigns the cheapest suitable carrier to it — in the WooCommerce admin, after the
order is placed.

**It does not touch the cart or the checkout.** No shipping method is registered,
no rate is shown to the customer, nothing about the buying experience changes.
The plugin works purely in the back office: the order arrives, the carrier is
calculated, and you see it on the order.

= What the plugin does =

* On every new order it sends the shipment parameters (weight, destination
  country, postcode, cash-on-delivery flag) to Dopravio and stores the result.
* Shows the recommended carrier in a metabox on the order detail screen —
  including the price breakdown, how the shipment splits into parcels, the other
  available carriers and the ones that cannot take the shipment (with a reason).
* Adds a **Carrier (Dopravio)** column to the orders list.
* If a physical product has no weight, no carrier is assigned. Instead the
  affected SKUs are reported on the order, because guessing a weight would mean
  guessing the price.
* Saves the chosen carrier in public order fields so your ERP or accounting
  system can read it (see below).

= Pulling the carrier into an ERP =

The chosen carrier is stored on the order under four public meta keys:

* `dopravio_carrier` — carrier name, e.g. `DPD`
* `dopravio_price` — shipping price in EUR, dot as the decimal separator
* `dopravio_parcels` — number of parcels (labels)
* `dopravio_status` — `assigned`, `missing_weight` or `unavailable`

They are readable through the standard WooCommerce REST API
(`/wp-json/wc/v3/orders`) using the API keys your integration already has —
both in `meta_data` and in a dedicated `dopravio` block with the full detail.
The plugin's **Dopravio → ERP connection** admin screen shows the exact keys and
a live sample response from your own shop.

= A Dopravio account is required =

The plugin is a client for the Dopravio service. Without an account and an API
key it does nothing. Dopravio is a paid service for the Slovak and Czech market
and its carrier catalogue covers carriers operating there.

= Slovensky =

Plugin pri každej objednávke vyberie najlacnejšieho dopravcu a priradí ho
k objednávke v administrácii WooCommerce. Do košíka ani do pokladne nezasahuje —
zákazník nič nové nevidí. Rozhranie pluginu je po slovensky. Vybraného dopravcu
si vieš vytiahnuť do ERP (Helios, Pohoda, Money…) cez REST API alebo z polí
objednávky; návod je v administrácii v sekcii Dopravio → Napojenie na ERP.

== External services ==

This plugin connects to the Dopravio API at https://www.dopravio.sk to calculate
which carrier is cheapest for a given shipment. It is required for the plugin to
work and only communicates once you have entered your Dopravio API key.

**When data is sent and what is sent:**

1. *When an order is created, and when you click Recalculate on an order* —
   the plugin sends the destination country, the destination postcode, the total
   weight and the weights of the individual items, the dimensions of the items
   where set, and whether the order is cash on delivery. The order number, your
   site URL and your shop name are sent so the result can be attributed to your
   shop. No customer name, address, e-mail or phone number is sent.
2. *While an administrator browses the WordPress admin (at most once every three
   minutes), and when the plugin's own admin screens are opened* — the plugin
   sends aggregated statistics of the last 90 days: the number of orders, the
   currencies used, and a histogram of order values. These are totals only; no
   individual order or customer data is included.
3. *Update check (only for copies downloaded from dopravio.sk, not for this
   version)* — this build takes its updates from WordPress.org.

Terms of service: https://www.dopravio.sk/podmienky
Privacy policy: https://www.dopravio.sk/ochrana-osobnych-udajov

== Installation ==

1. Install and activate the plugin.
2. Go to **Dopravio → Settings**, enter `https://www.dopravio.sk` and your API
   key, or click **Connect through Dopravio** to have the key filled in for you.
3. Place a test order, or open an existing one and click **Calculate through
   Dopravio**.

You need WooCommerce 7.0 or newer. Both the classic order storage and High
Performance Order Storage (HPOS) are supported.

== Frequently Asked Questions ==

= Does it change what the customer sees at checkout? =

No. The plugin registers no shipping method and no checkout hooks. It only works
with orders that already exist.

= Why is no carrier assigned to some orders? =

Because a physical product in the order has no weight set. Without a weight the
price cannot be calculated, and a guessed weight would mean a guessed carrier.
The order shows which SKUs are missing a weight — fill them in and click
Recalculate.

= Can my accounting system read the chosen carrier? =

Yes. See **Pulling the carrier into an ERP** above, or open
**Dopravio → ERP connection** in the admin for the exact keys and a live sample.

= Does it work without a Dopravio account? =

No. The plugin is a client for the Dopravio service and needs an API key.

== Screenshots ==

1. The recommended carrier on the order detail screen, with the price breakdown.
2. The Carrier (Dopravio) column in the orders list.
3. The ERP connection screen with the exact field names.

== Changelog ==

= 1.0.0 =
* First release in the WordPress.org directory.
* The chosen carrier is now also stored in public order fields and exposed in
  the WooCommerce REST API, so ERP and accounting systems can read it.
* New admin screen documenting the ERP connection, with a live sample response.
