Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Real-time pricing and inventory tracking

Describes real-time pricing and inventory tracking in Optimizely Configured Commerce.

Enabling the real-time pricing and/or inventory service on your website in Optimizely Configured Commerce displays "real-time" pricing and inventory from calls made to the ERP. This is in contrast to the Generic pricing or inventory service, which is dependent on recurring integration jobs that typically run once in a 24 hour period.

Typically, implementations will set up the real-time pricing service to also request the inventory data at the same time and place it all in the cache. This allows for the pricing and inventory data to be retrieved almost instantaneously. As the data is retrieved and loaded on the page, there may be a short lag which is indicated by an animated ellipses.

📘

Note

Although it is possible to request both the pricing and inventory data uniquely via different calls, its considered a best practice to request the data within the same call to reduce the pings to the ERP.

Real-time setup

As you will see in the steps below, aside from the specific setting names, setting up real-time pricing and real-time inventory is almost identical. However, for the sake of clarity, both options are described below.

Set up for pricing

To retrieve the pricing data, the Pricing Service setting needs to be set to RealTime or some other custom created service. Upon selecting RealTime, or a service other than Generic, the additional Pricing Service settings are exposed.

  1. Go to Admin Console >Administration >System >Settings and search for Pricing Service.

  2. Select Pricing Service

Additional Pricing Service Settings

There are several additional settings that control the connections and frequency for when inventory calls are made:

  • Connection – Optional connection to the API Endpoint. This field is only populated with Integration Jobs created where the Type Name is ApiEndpoint.

    This optional setting simplifies the process in two ways: removes the need to hard code credentials and allows developers to uniquely define the connection criteria for production and sandbox environments.

    A new integration connection is made via Admin Console > Jobs > Connections, selecting the Add Integration Connection button and then selecting ApiEndPoint from the Type Name menu. This connection type stores the API address, Username, and Password.

  • Real-time Pricing Service – The real-time pricing service name.

  • Real-time Service Timeout Seconds – The real-time inventory service name.

  • Real-time Service Cache Minutes – Time to wait for real-time inventory service to return. Default value: 10

  • Real-time Service Unavailable Retry Minutes – Number of minutes to wait if the real-time service timed out. Default value: 5

  • Real-time Service Delay Seconds – Number of seconds to delay the real-time inventory. This is used for testing and should be set to 0 in a production environment. Default value: 0

Set up for inventory

To retrieve the inventory data, the Inventory Service setting needs to be set to RealTime or some other custom created service. Upon selecting RealTime, or some service other than Generic, the additional Inventory Service settings are exposed.

  1. Go to Admin Console >Administration >System >Settings and search for Inventory Service.
  2. Select RealTime.

Additional inventory service settings

To control the connections and frequency for when inventory calls are made:

  • Connection – Optional connection information to the API Endpoint.

    This is a convenience feature that allows developers the option to create a new integration connection to an API endpoint that can then be selected via this setting. This simplifies the process, as it removes the need to hard code necessary credentials. A new integration connection is made via Admin Console > Jobs > Connections, selecting the Add Integration Connection button and then selecting ApiEndPoint from the Type Name menu. This connection type stores the API address, Username, and Password.

  • Real-time Inventory Service – The real-time inventory service name.

  • Real-time Service Timeout Seconds – The real-time inventory service name.

  • Real-time Service Cache Minutes – Time to wait for real-time inventory service to return. Default value: 10

  • Real-time Service Unavailable Retry Minutes – Number of minutes to wait if the real-time service timed out. Default value: 5

  • Real-time Service Delay Seconds – Number of seconds to delay the real-time inventory. This is used for testing and should be set to 0 in a production environment. Default value: 0

  • Included With Pricing – If Yes, then inventory is expected to be returned with pricing and the system will not execute the inventory service until pricing is completed. Default value: Off

Extensibility

The real-time inventory functionality provides some opportunities for developers to extend the platform. When calls are made to retrieve product inventory, it pulls down a number of collections, such as inventory by warehouse and inventory by unit of measure, which are then interpreted and calculated. The results of these calculations can then be exposed on the storefront. So, for example, you could display the number of items available at each warehouse in a number of places within the storefront. This specific example requires that the data be correctly mapped into the API call and then exposed via customization made to the desired widget.

Inventory messaging

In the case where inventory is not available, due to the product not being tracked, the service being down, missing inventory information, and so on there options and logic for what is displayed on the storefront. To understand and configure this, review the Overview of Inventory Management article, specifically the Availability Message Workflow section.