Changed on:
19 Feb 2024
The rule calculates distances, in meters, from each location to the order delivery address based on the incoming longitude/latitude. Sends event with attributes containing calculated distances.
Plugin Name | Order Reference Module |
---|---|
Namespace | [[account.id]].order |
The Order Reference Module is the foundation for order-related implementations. It provides reference workflows for click & collect, home delivery and mixed baskets and those needed to build your own. Extensible by design, use this Module as a base to build a solution to your customers' needs.
Calculates the distances from each location to the order delivery address. Sends event with attributes containing calculated distances.
Parameter | Description |
eventName | The event name triggered by this rule |
Parameter | Description | Data Type | Required? |
locations | The map of locations objects with longitude and latitude properties. | Map | Required |
longitude | The longitude in the request compared to the longitude in the location property for calculate the distances of each location. | Double | Required |
latitude | The latitude in the request compared to the latitude in the location property for calculate the distances of each location. | Double | Required |
This rule does not explicitly identify any exceptions.
1{
2 "name":"<ACCOUNTID>.order.CalculateLocationsDistances",
3 "props": {
4 "eventName":"UPDATE_ORDER"
5 }
6}
Language: json
The rule calculates distances using the Great-Circle Distance (GCD) method. Essentially, it determines the shortest path between two points on the Earth's surface, akin to a straight line drawn on a globe. This method accounts for the Earth's curvature, providing precise measurements compared to simpler distance calculations.
The distance is calculated in meters for each location, and the information is passed along in an inline event to the next ruleset. The applied formula is the Haversine formula.
refers to plugin
Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.