Try Reallocate on Cancel Using Geo Location
Reallocate an order to the nearest warehouse using geographic coordinates when a location cancels.
Overview
The Try Reallocate on Cancel Using Geo Location step handles order reallocation when a fulfillment location cancels, using geographic coordinates (latitude/longitude) to find the nearest alternative warehouse. This provides more accurate proximity calculations than zip code-based methods.
Identifier
| Property | Value |
|---|---|
| Key | TryReallocateOnCancelUsingGeoLocation |
| Group | Reallocate |
| Applicable Statuses | New |
Configuration Properties
| Property | Type | Required | Description |
|---|---|---|---|
retryLimit | number | No | Maximum number of reallocation attempts |
StoreRoles | string | No | Filter eligible warehouses by role |
Behavior
What It Does
- Checks if reallocation should be skipped (
context.SkipReallocation) - Checks if order is already allocated (
context.OrderIsAllocated) - Uses coordinate-based distance calculation to find the nearest warehouse with available stock
- If successful, logs event and triggers status change back to "New"
- Sets
CancelWorkflow = trueto restart order processing
Prerequisites
- Order must have delivery address with valid coordinates
- Warehouses must have coordinates configured
- Order must not already be allocated
context.SkipReallocationmust not be set
Side Effects
- Changes warehouse assignment
- Records reallocation event with from/to warehouses
- Triggers status change to "New" to restart order processing
- Cancels the current workflow
Business Cases
When to Use
- Accurate proximity: When zip code boundaries don't reflect actual distances well
- Rural areas: Where zip codes cover large geographic areas
- Cross-border: When orders near borders might be closer to warehouses in different regions
Example Scenarios
Scenario 1: Border Proximity A customer near the Norwegian-Swedish border has their order cancelled by a Norwegian store. Geo-location routing finds a closer Swedish warehouse.
Scenario 2: Rural Delivery In areas with large zip codes, coordinate-based routing finds the truly closest warehouse rather than relying on postal zones.
Error Handling
| Condition | Result | Continues Workflow? |
|---|---|---|
| Reallocation skipped | Success | Yes |
| Already allocated | Success | Yes |
| No alternative warehouse | Success (no reallocation) | Yes |
| Successful reallocation | Success (triggers New status) | No (cancels workflow) |
Related Steps
- Try Reallocate on Cancel - Uses zip code instead of coordinates
- Try Split Unreserved to Nearest Coordinates - Coordinate-based splitting
