Integrations / Salesforce Commerce Cloud B2C

Real-time inventory updates

The indexing jobs keep Algolia in sync on a schedule, but high-velocity stores need instant stock updates. Version 25.3.0 introduces an Enable Real-Time Inventory preference and a lightweight hook that pushes changes to Algolia immediately after checkout.

Real-time updates don’t replace existing inventory jobs: they complement them. The existing system still handles bulk changes. Stores with high turnover require real-time updates to synchronize inventory because delta jobs don’t support inventory or pricing updates.

Enable the feature

  1. Go to Merchant Tools › Algolia › Algolia.
  2. Enable Enable Real-Time Inventory and click Apply.
  3. The cartridge starts sending inventory data to Algolia in real time.

How real-time inventory updates work

  1. After each order, the cartridge’s CheckoutServices-PlaceOrder controller fires the inventoryUpdate hook.
  2. Shipments are checked to classify orders as in-store pickup or regular (store inventory) orders.
  3. If some products become out of stock, the hook script computes the affected products (master and variants) and prepares partialUpdateObject operations.
  4. The updates are sent to Algolia so the in_stock and storeAvailability fields reflect the latest order status.

If IndexOutOfStock is false (default) and the product is out of stock, the product is removed from the Algolia index.

Troubleshooting

No update after an order

  • Ensure Enable Real-Time Inventory is enabled and the product’s new inventory level is below the InStock Threshold.
  • In the Algolia dashboard, go to API Monitoring > Search API Logs and verify that the request was sent.
  • Check the Salesforce B2C Commerce logs for AlgoliaOperation errors.

Out-of-sync stock

If the issue persists, fully reindex your product catalog.

Did you find this page helpful?