Skip to main content
Related API: This extension modifies the Create Order operation.
This action occurs before an order is created from the cart. Changes made to the order or order items in this action persist in Kibo.
Action TypeEmbedded
Full Action IDembedded.commerce.orders.createFromCart.before
Runs multiple custom functions?No

JavaScript File Structure

Action files share the following basic structure:
When you code the custom function for an action, you have access to two arguments: callback—This argument follows the established JavaScript callback pattern: it takes an error as the first argument (or null if there is no error) and a result as the second argument (if required). context—This argument provides the function access to relevant objects and methods that interface with Kibo.

Context: Order

The methods and objects documented here are available to this action through the use of the context argument. Microservice Operation
This action corresponds to the microservice that creates orders from the cart.

Get

get.order

Obtains a response that includes information about the current order.
ParameterTypeDescription
N/AN/AN/A
Example:
Response:
For information about the properties in the response, refer to the REST API Help.

Exec

exec.setItemAllocation

Sets soft allocation information on an order item.
ParameterTypeDescription
allocationIdintId of the allocation to set on the order item.
expirationdate/timeDate/time of the allocation expiration.
productCodestringCode of the product or product variation that is allocated.
itemIdstringId of the item to set the allocation on if applied to a line item that is not the current line item. Current line item only applies when called for an order item action.
Example:
Response:
For information about the properties in the response, refer to the REST API Help.

exec.setAttribute

Sets an attribute from the order.
ParameterTypeDescription
fqnstringFully-qualified name of the attribute to set on the order. Must apply to an existing attribute.
valueobjectValue or values to set on the order for the specified attribute.
Example:
Response:
For information about the properties in the response, refer to the REST API Help.

exec.removeAttribute

Removes an attribute from the order.
ParameterTypeDescription
fqnstringFully-qualified name of the attribute to set on the order. Must apply to an existing attribute.
Example:
Response:
For information about the properties in the response, refer to the REST API Help.

exec.setData

Sets custom key/value data on the current order.
ParameterTypeDescription
keystringKey of the data to set on the order.
valueobjectValue of the data to set.
Example:
Response:
For information about the properties in the response, refer to the REST API Help.

exec.removeData

Removes custom key/value data from the current order.
ParameterTypeDescription
keystringKey of the data to remove from order.
Example:
Response:
For information about the properties in the response, refer to the REST API Help.

exec.setItemData

Sets custom key/value data on an order item.
ParameterTypeDescription
keystringKey of the data to set on the order item.
valueobjectValue of the data to set.
itemIdstringId of the order item to which the data is applied.
Example:
Response:
For information about the properties in the response, refer to the REST API Help.

exec.removeItemData

Removes custom key/value data from an order item.
ParameterTypeDescription
keystringKey of the data to remove from the order item.
itemIdstringId of the item from which to remove data if applied to a line item that is not the current line item. Current line item only applies when called from an order item action.
Example:
Response:
For information about the properties in the response, refer to the REST API Help.

exec.setDutyAmount

Sets the duty amount applied to an order.
ParameterTypeDescription
dutyAmountnumberThe duty amount to set on the order.
Example:
Response:
For information about the properties in the response, refer to the REST API Help.

exec.setHandlingAmount

Sets the handling amount applied to an order. This method is only available for the embedded.commerce.orders.price.before action. In addition, do not use both the setHandlingAmount and the setItemHandlingAmount methods within the same function, as this forces ambiguous adjustments on the handling amount.
ParameterTypeDescription
handlingAmountnumberThe handling amount to set on the order.
Example:
Response:
For information about the properties in the response, refer to the REST API Help.

exec.setItemHandlingAmount

Sets the handling amount applied to an order item. This method is only available for the embedded.commerce.orders.price.before action. In addition, do not use both the setHandlingAmount and the setItemHandlingAmount methods within the same function, as this forces ambiguous adjustments on the handling amount.
ParameterTypeDescription
handlingAmountnumberThe handling amount to set on the order.
itemIdstringId of the item for which to set the handling amount.
Example:
Response:
For information about the properties in the response, refer to the REST API Help.

Context Objects Available to All Actions

apiContext

Accesses tenant information.
PropertyTypeDescription
baseUrlstringThe base URL for the site.
basePciUrlstringThe base PCI URL for the site.
tenantPodstringThe name of the tenant pod in which the tenant resides.
appClaimsstringThe application claims token.
appKeystringThe application key.
tenantIdintegerUnique identifier for the tenant.
siteIdintegerUnique identifier for the site. This ID is used at all levels of a store, catalog, and tenant to associate objects to a site.
masterCatalogIdintegerUnique identifier for the master catalog.
catalogIdintegerThe unique identifier for the product catalog. Catalogs are part of a master catalog.
currencyCodestringThe default three-letter ISO currency code for monetary amounts.
previewDatedate/timeThe date and time that the content is being viewed. This might be a future date if the content is previewed with an active date range set in the future.
localeCodestringThe locale code per the country code provided. This code determines the localized content to use and display.
correlationIdstringThe unique identifier of the API request associated with the event action, which might contain multiple actions.
isAuthorizedAsAdminBooleanIndicates whether the Dev Account user is authorized as an admin.
userClaimsstringThe user claims token.
Example:

configuration

Receives a JSON response that contains information about the configuration data set in the Action Management JSON editor.
PropertyTypeDescription
VariesobjectCustom fields and values that you can set in the Action Management JSON Editor.
Example: