Skip to content

PricingAndInventory#


Description#

This function will allow you to pass in an array of product codes or IDs and get back the current price (including any discounts) and inventory counts. This function is intended to be called in front end JavaScript for when a 3rd party search provider may not have the most up-to-date pricing or discount data for products.

Note

This function is part of the Search Spring Live Indexing module and it is required to be installed (but not required to be used).

Request Body Parameters#

Parameter
Type Description
Session_Type String This will always be “runtime”
Function String Because this is a module defined function, this value will always be “Module”
Module_Code String Code of the module which defines the function. Will always be “searchspringlive” for this function
Module_Function String Function Name you wish to execute
Identifier String Possible values include: code or id
Codes String Comma-separated list of product codes to lookup and return pricing and inventory for. Only passed if identifier is set to “code”
Ids String Comma-separated list of product IDs to lookup and return pricing and inventory for. Only passed if identifier is set to “id”

Note

Product Identifier can be Codes or Ids but not both in the same request.

Response Parameters#

Parameter
Type Description
success Boolean True/false whether the request was successful
price Number Product price including any product level discounts applied to the product
inv_active Boolean Boolean for if inventory is being tracked for this product
inv_level String One of In Stock, Low Stock, Out of Stock (in, low, out)
inv_available Number Inventory Available. This is the in-stock amount - threshold you have set for out-of-stock level (default is 0)
inv_instock Number Inventory In Stock
inv_short String Inventory Short Message
inv_long String Inventory Long Message

Example Request#

{
    "Store_code": "beta",
    "Session_Type": "runtime",
    "Function": "Module",
    "Module_Code": "searchspringlive",
    "Module_Function": "PricingAndInventory",
    "Product_IDs": [1, 2, 3],
    "Product_Codes": ["shirt", "pants"]
}

Example Response#

{
    "success": 1,
    "data": {
        "shirt": {
            "price": 10.0,
            "inv_active": true,
            "inv_level": "in",
            "inv_available": 100,
            "inv_instock": 100,
            "inv_short": "In Stock",
            "inv_long": "100 available for immediate delivery"
        },
        "pants": {
            "price": 25.0,
            "inv_active": false,
            "inv_level": "",
            "inv_available": 0,
            "inv_instock": 0,
            "inv_short": "",
            "inv_long": ""
        }
    }
}