Algolia Sync Target
The Algolia sync target pushes nFusion pricing data into an Algolia search index. This enables real-time price display in the Dealers site's search & browse experience powered by WP Search with Algolia.
How It Works
The provider:
- Reads the Algolia credentials and index name from environment variables (using the configured prefix).
- Maps nFusion price fields to Algolia object fields using the field mapping configuration.
- Applies optional payment method adjustments (e.g., credit card surcharge, wire discount).
- Batches updates and sends them to Algolia using
partialUpdateObjects(only price fields are updated; other product attributes are untouched).
Configuration Settings
Configured per sync target in the Filament admin:
Connection Prefix
The provider reads Algolia credentials using a prefix, e.g. ALGOLIA:
| Env Var | Description |
|---|---|
{PREFIX}_APP_ID | Algolia Application ID |
{PREFIX}_ADMIN_KEY | Algolia Admin API Key |
{PREFIX}_INDEX_NAME | Target index name |
Example with prefix DEALERS_ALGOLIA:
DEALERS_ALGOLIA_APP_ID=XXXXXXXXXX
DEALERS_ALGOLIA_ADMIN_KEY=xxxxxxxxxxxxxxxxxxxx
DEALERS_ALGOLIA_INDEX_NAME=dealer_products
Batch Size
Number of Algolia partial-update objects sent per API call. Default: 100. Range: 10–1000.
Field Mapping
Defines which nFusion fields map to which Algolia attribute names and in what format.
| nFusion Field | Available Algolia Name | Formats |
|---|---|---|
sku | (any) | string |
ask | (any) | float, currency |
bid | (any) | float, currency |
wholesale_ask | (any) | float, currency |
wholesale_bid | (any) | float, currency |
retail_tiers | (any) | raw |
wholesale_tiers | (any) | raw |
best_price | (any) | float, currency |
sale_ask | (any) | float, currency |
Default mapping:
sku → sku (string)
ask → regular_price (float)
retail_tiers → retail_tiers (raw)
Payment Method Adjustments
Optional price adjustments applied per payment gateway:
| Gateway Key | Description |
|---|---|
cc | Credit card — typically a small surcharge |
wire | Wire transfer — typically a discount |
crypto | Cryptocurrency — configurable |
Each adjustment stores an adjust_field (which nFusion field to adjust) and an adjust_value (a fixed dollar or percentage modifier). The adjusted price is stored in the Algolia object under a configurable field name (e.g., cc_price, wire_price).
Algolia Object Structure
After a sync run, each product object in Algolia is updated with (minimum):
{
"objectID": "PROD-SKU-001",
"sku": "PROD-SKU-001",
"regular_price": 28.50,
"retail_tiers": [
{"qty": 1, "ask": 28.50, "markup": 1.50},
{"qty": 10, "ask": 27.00, "markup": 0.00}
]
}
Only configured fields are included in the partial update — existing Algolia attributes (images, descriptions, etc.) are preserved.
Key File
app/SyncTargets/Algolia/AlgoliaSyncTargetProvider.php