The Order drop-in component provides the following API endpoints, allowing developers to perform various account-related operations and create custom implementations:
cancelOrder
The cancelOrder function is a wrapper for the cancelOrder mutation. You must pass an order ID and reason,
Parameter
Type
Req?
Description
orderId
string
Yes
The ID of the order to cancel.
reason
string
Yes
The reason for canceling the order.
onSuccess
Function
No
The callback function to execute when the order is successfully canceled.
onError
Function
No
The callback function to execute when an error occurs.
Returns
Returns a promise that resolves to a void, null, or undefined value.
Usage
confirmCancelOrder
The confirmCancelOrder function confirms the cancellation of an order after the guest user clicks on a URL provided in an order cancellation confirmation email. The confirmation key is generated when the guest requests to cancel an order.
Parameter
Type
Req?
Description
orderId
string
Yes
The ID of the order to cancel.
confirmationKey
string
Yes
A key generated when a guest requests to cancel an order.
Returns
Returns a promise that resolves to an OrderDataModel object.
Usage
getAttributesForm
The getAttributesForm function is a wrapper for the attributesForm query. You must pass an attribute code to retrieve the form.
Parameter
Type
Req?
Description
formCode
string
Yes
One of "customer_account_create", "customer_account_edit", "customer_address_create", "customer_address_edit".
Returns
Returns a promise that resolves to an array of AttributesFormModel objects.
Usage
getAttributesList
The getAttributesList function is a wrapper for the attributesList query. You must pass an attribute code to retrieve the list. The system default values are CUSTOMER, CUSTOMER_ADDRESS, CATALOG_PRODUCT and RMA_ITEM.
Parameter
Type
Req?
Description
entityType
string
Yes
The entity type for which to retrieve the list of attributes.
Returns
Returns a promise that resolves to an array of AttributesFormModel objects or an empty array.
Usage
getCustomer
The getCustomer function is a wrapper for the customer query. You must pass a customer ID to retrieve the customer data.
Returns
Returns a promise that resolves to a CustomerDataModelShort object.
Usage
getCustomerOrdersReturn
The getCustomerOrdersReturn function returns details about the returns a customer has requested. It is a wrapper for the customer query.
Parameter
Type
Req?
Description
pageSize
number
No
The number of orders to return at a time.
Returns
Returns a promise that resolves to a CustomerOrdersReturnModel object or null.
Usage
The following example demonstrates how to retrieve a customer’s return orders:
getGuestOrder
The getGuestOrder function is a wrapper for the guestOrder query.
Parameter
Type
Req?
Description
number
string
Yes
The order number.
email
string
Yes
The email address associated with the order.
lastname
string
Yes
The last name associated with the order.
Returns
Returns a promise that resolves to an OrderDataModel object or null.
Usage
The following example demonstrates how to retrieve a guest order:
getOrderDetailsById
The getOrderDetailsById function is a wrapper for the customer query. You must pass an order ID to retrieve the order details.
Parameter
Type
Req?
Description
orderId
string
Yes
The ID of the order to retrieve.
returnRef
boolean
No
Whether to return the reference.
queryType
QueryType
No
The type of query to perform. Use orderData as the value
returnsPageSize
number
No
The number of returns to return at a time.
Returns
Returns a promise that resolves to a TransformedData object.
Usage
type QueryType = ‘orderData’;
getStoreConfig
The getStoreConfig function returns information about the storefront configuration. It is a wrapper for the storeConfig query.
Returns
Returns a promise that resolves to a StoreConfigModel object or null.
Usage
The following example demonstrates how to retrieve the store configuration:
guestOrderByToken
The guestOrderByToken function retrieves a guest order using a token generated by Adobe Commerce. It is a wrapper for the guestOrderByToken query.
Parameter
Type
Req?
Description
token
string
No
A token for the order assigned by Adobe Commerce.
returnRef
string
No
The reference to return.
Returns
Returns a promise that resolves to an OrderDataModel object or null.
Usage
reorderItems
The reorderItems function allows a logged-in customer to add all the products from a previous order into their cart. It is a wrapper for the reorderItems mutation.
Parameter
Type
Req?
Description
orderNumber
string
Yes
The order number to reorder.
Returns
Returns a promise that resolves to a ReorderItemsProps object.
Usage
The following example demonstrates how to reorder items from a previous order:
requestGuestOrderCancel
The requestGuestOrderCancel function is simmilar to the cancelOrder function, but it is used for guest orders. The token is a unique value generated using guest’s email, order number and postcode
Parameter
Type
Req?
Description
token
string
Yes
The token for the order assigned by Adobe Commerce.
reason
string
Yes
The reason for canceling the order.
onSuccess
Function
No
The callback function to execute when the order is successfully canceled.
onError
Function
No
The callback function to execute when an error occurs.
Returns
Returns a promise that resolves to a boolean value.
Usage
requestReturn
The requestReturn function takes the RequestReturnProps form as an argument and initiates the process of returning items from an order. It is a wrapper for the requestReturn mutation.
Parameter
Type
Req?
Description
form
RequestReturnProps
Yes
The form data for the return request.
The RequestReturnProps object has the following properties:
Returns
Returns a promise that resolves to an object containing the return request details.