🔒

Requires write_cart_transform access scope.

The Cart-Transform Function API allows developers to bind a previously uploaded Function to the cart price adjustment process in Shoplazza. Once bound, Shoplazza will automatically execute the function during cart and checkout stages to dynamically modify product prices.

  • Automatically applies the function logic to cart and checkout pricing.
  • Only one function can be bound to the cart price adjustment at a time.
  • Supports failure handling options (block_on_failure).

Request Parameters

Public Request Parameters

📘

Public Request Parameters

Body Parameters

ParameterTypeRequiredDescription
function_idstringYesThe function_id returned from the Function API after uploading, which specifies the price adjustment logic.
block_on_failureboolNoDetermines whether to block the cart/checkout process if the Function execution fails.
Default false
input_queryraw json stringNoA JSON string specifying metafield queries for cart line items.

input query structure

ParameterTypeRequiredDescription
product_metafields_queryarrayNoDefines rules to query Metafield data. If empty, the function input will not contain Metafield data. The array length is limited to 1, currently supporting only one key.
namespacestringYesThe namespace of the Metafield.
keystringYesThe key of the Metafield.

Example input_query JSON:

"{\"product_metafields_query\": [{\"namespace\": \"custom-option\", \"key\": \"adjust-10-price\"}]}"

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Successful Response

ParameterTypeRequiredDescription
codestringYesResponse status code, "SUCCESS" if successful
messagestringYesResponse message, "SUCCESS" if successful
dataobjectYesContains response data
data.idstringYesUnique cart-transform-function ID
data.block_on_failureboolYesIndicates whether failure should block checkout (false by default)

Error Response

FieldTypeDescriptionExample
codestringThe error code indicating the type of issue.InvalidParameter
messagestringA detailed message describing the error.wrong cursor
Language
Credentials
URL
Click Try It! to start a request and see the response here!