Order routing is the process of making sure your order ends up in the correct warehouse. This is done using a configuration of “regions” which are then connected with logistics providers and filters.
Note: Customers prior to May 2024 usually have a simpler for or routing called Product Mapping. If you are an existing customer and cannot find order routing in your app, please contact us to migrate.
Example
In this article we will use the fictional e-shop “Acme AB” that has two warehouses:
- One central warehouse in Sweden called “Stockholm”
- A newly added US warehouse called “New York”
Regions
A “region” is a geographical space that contains one or more counties or areas. For example “European Union” is an area and but “United Status of America” is a country. Currently regions are only configured using country or area codes, but this might change later with more advanced filtering.
Using our example, if Acme AB would like to send orders for North America to New York, it would might sense to use two regions:
- North America – Served by New York
- Rest of World – Served by Stockholm
The “rest of world” region
There is a region that uses a “*” for country code called “Rest of World” which is always present and cannot be deleted. It is used as a catch-all if no other region can be matched for a given order.
Matching orders with regions
Prime Penguin will use the recipient address country code of an order when selecting which region it should be served from. If no region matches, the “rest of world” region will receive the order.
Priority
Regions are matched in the order they appear in the UI. If two regions serve the same country, the region first in the list will be selected for an order.
Exclusivity
When a regions is selected for an order, the selection is final. Prime Penguin will never give the same order to multiple regions.
Activation
A region is either “active” or not active. A non-active region will not receive any orders.
Region logistics providers
When you have connected a logistics provider you can associate that provider with a region. Each region can have a list of logistics providers and Prime Penguin will try to match the order with a warehouse in the order they are configured.
Filtering
For multiple warehouses to make sense in a region, filters can be applied. They are simple order expressions that determine if a warehouse is capable of handling the order.
For example, to filter out a logistics provider if it does not have stock to fulfill the order, the trivial expression has_stock() will make sure no orders gets forwarded to that logistics provider if it cannot fulfill the entirety of the order. See the article filter expressions or the example below on how to use it.
Fallback
If for any reason a region is selected, but Prime Penguin cannot match the order with a logistics provider (or indeed, the regions doesn’t have any logistics providers configured), the order will be forwarded to the dropship logistics provider.
Activation
A logistics provider in a region is either “active” or not active. A non-active logistics provider will not receive any orders.
Example
If Acme AB is a completely new customer that haven’t previously configured any order routing and wants to use New York for North American orders, but not have all products stocked there, they could setup their routing like this.
Regions
We’ll create a new region called “North America” that serves USA and Canada. They would then have two region that would look like this:
- North America – CA, US – – active
- Rest of World – * – Dropship – active
They have dropship mapped to rest of world since that’s the default for new Prime Penguin customers. If left like this, all orders would end up in dropship as no logistics provider is associated with the regions.
Logistics Providers
Anything outside of US and CA should be served by Stockholm, so they would remove dropship and add Stockholm to the rest of work region. They don’t need any filtering since Stockholm will take all orders from the region.
Their region list now looks like this:
- North America – CA, US – – active
- Rest of World – * – Stockholm – active
Left like this all order for US or CA would still end up in dropship (since that region does not have a logistics provider yet), but everything else would go to Stockholm.
Now we can add two logistics providers to the North America region:
- New York – active –
- Stockholm – active –
Left like this any order or US or CA would end up in New York since Prime Penguin selected warehouse in the order they are configured.
Filtering
We also know that New York does not have all stock, so we can edit New York and add a filter (see Testing order routing for details):
- has_stock()
The logistics provider list now looks like this:
- New York – active – has_stock()
- Stockholm – active –
How the routing works
An order for the US
- Prime Penguin tries to match the order recipient country code in order of the configured regions, and selects: North America
- Prime Penguin matches the order against each warehouse in North America, in the order they are configured:
- If New York have stock for the order: the order is routed to New York
- If New York does not have stock for the order: the order is Routed to Stockholm
An for for DE
- Prime Penguin tries to match the order recipient country code in order of the configured regions, and selects: Rest of World
- Prime Penguin matches the order against each warehouse in Rest of World, in the order they are configured. Since there is only one warehouse with no filter: the order is routed to Stockholm