Fluent Commerce Logo
Docs
Essential knowledgeCore knowledge to understand Fluent Commerce

Intended Audience:

Technical User

Author:

Holger Lierse

Changed on:

17 Sept 2025

Overview

The `LocationUtils` class in the `util-sourcing` is a utility class that provides utilities for location-based sourcing decisions. It handles location-specific sourcing logic including distance calculations, location availability checks, and provide location-based caching optimization.

Key points

  • Location-Based Decisions: Handles location-specific sourcing logic.
  • Distance Calculations: Calculates distances between locations for proximity-based sourcing.
  • Location Availability: Checks if locations are active and available for sourcing.
  • Caching Optimization: Provides location-based caching optimization.

Core Methods

`getLocationByRef()`
Loads a single Location by provided reference, with caching for performance.
`getLocationsInNetwork()` 
Load all the locations in a network with caching for performance.
`getLocationsInNetworks()`
Loads all locations that belong to the provided networks.
`distanceInMetres()`
Calculate distance between two points in latitude and longitude using the Haversine formula.