Nova Poshta

Nova Poshta as a shipping carrier: syncs its own settlement and warehouse directory, matches it to the locations registry once, and prices delivery live. “To branch”, “to parcel locker” and “by courier” are separate shipping methods that name this carrier.

Admin section
Logistics
Version
0.1.0 · torgash.novaposhta
Installed with
The Minimum and Shop sets, for a shop in this country
Countries
UA
Needs
Shipping, Locations

Setting up Nova Poshta

1. The API key

Paste your Nova Poshta API key into the module’s settings (Modules → Nova Poshta → the gear). The data screen has a Check button that makes one live call, so you learn straight away whether the key works — rather than from a background job that fails ten minutes later.

Everything below needs the key.

2. Sync the settlement directory

Modules → Nova Poshta → its documentation link opens the data screen → Sync directory. This pulls the carrier’s ~27 000 settlements and ~11 000 “cities” into m_np_settlements (about 17 seconds). It runs as a background task — watch it under System → Background tasks.

Once the project’s scheduler is running it refreshes itself weekly; until then, press the button when the carrier’s list has moved.

3. Match places to your registry

Match with the registry ties each Nova Poshta settlement to a torgash.locations place. On live Ukrainian data this lands about 90% of places automatically; the rest have no counterpart on the carrier’s side (Crimea, occupied areas, villages the carrier does not list) and simply do not offer Nova Poshta. See Place matching.

A place with no match is shown in the unmatched list, where you can bind it by hand — and a manual binding survives every later re-match.

4. Branches

Branches are fetched lazily, per town: the first checkout that names a town pays for one request, everyone after reads the cache (a day, by default). For a shop that would rather have the whole country in its database up front, Load all branches walks every matched town, biggest first, inside a time budget — re-run it and it continues where it stopped.

5. The delivery method

Add a shipping method (Shipping → Methods), set Priced by → Nova Poshta on the Carrier tab, and pick the variant: to a branch or by courier. For live pricing, also set the sender city on the data screen — without it the method is priced from your own rate table instead, which is a supported way to run it.

Place matching

Nova Poshta addresses branches by a settlement Ref (a UUID), never by name. So before the module can offer the carrier for a town, that town has to be tied to a Nova Poshta settlement. The carrier’s own plug-ins solve this by selling a pre-matched data pack; this module works it out from the API.

How a match is made

Match with the registry runs a chain, stopping at the first step that is unambiguous:

  1. name + region + district
  2. name + region — only when exactly one candidate remains
  3. postal code — the carrier’s settlement index falls inside the place’s postal_from..postal_to range, and only one candidate does
  4. coordinates — the nearest candidate, but only if it is closer than 30 km and twice as close as the next one
  5. name unique in the country + coordinates agree — for Kyiv, Sevastopol and the like, where the two sides name the region differently

Anything still ambiguous is left for a human. Re-running the match replaces every automatic binding; a binding you made by hand (manual) is never touched.

The unmatched list

The data screen lists places with no match. For each, the picker searches the carrier’s directory and shows, for every candidate, the distance and whether its postal code falls in range — so eight identical “Іванівка"s stop being a coin toss. Click This one to bind, Unbind to undo.

Why some places never match

On live Ukrainian data roughly 2 800 places have no Nova Poshta counterpart at all: Crimea and Sevastopol (the carrier has zero rows there), much of Donetsk and Luhansk, and villages the carrier simply does not serve. Those places just do not offer Nova Poshta — which is the same thing the carrier’s own module does.