Checkout Functions
The Checkout drop-in provides API functions that enable you to programmatically control behavior, fetch data, and integrate with Adobe Commerce backend services.
| Function | Description |
|---|---|
estimateShippingMethods | Calls the estimateShippingMethods mutation.. |
getCart | Retrieves the current cart’s checkout data from Adobe Commerce. |
getCheckoutAgreements | Returns a list with the available checkout agreements. |
getNegotiableQuote | Retrieves a negotiable quote for B2B customers. |
getStoreConfig | The storeConfig query defines information about a store’s configuration. |
isEmailAvailable | Calls the isEmailAvailable query.. |
setBillingAddress | Calls the setBillingAddressOnCart mutation.. |
setGuestEmailOnCart | Calls the setGuestEmailOnCart mutation.. |
setPaymentMethod | Calls the setPaymentMethodOnCart mutation.. |
setShippingAddress | Calls the setShippingAddressesOnCart mutation.. |
setShippingMethods | Sets one or more shipping methods on the cart. |
estimateShippingMethods
The estimateShippingMethods function calls the estimateShippingMethods mutation.
const estimateShippingMethods = async ( input?: EstimateShippingInput): Promise<ShippingMethod[] | undefined>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | EstimateShippingInput | No | An object of type EstimateShippingInput, which contains a criteria object including the following fields: country_code, region_name, region_id, and zip. |
Events
Emits the shipping/estimate event.
Returns
Returns an array of ShippingMethod objects or null.
getCart
The getCart function retrieves the current cart’s checkout data from Adobe Commerce. It automatically uses the cart ID from internal state and calls either the getCart or customerCart GraphQL query depending on authentication status. The returned data includes billing address, shipping addresses, available and selected payment methods, email, total quantity, and virtual cart status—all the information needed to complete the checkout process.
const getCart = async (): Promise<any>Events
Does not emit any drop-in events.
Returns
Returns a Cart model containing complete checkout information.
getCheckoutAgreements
The getCheckoutAgreements function returns a list with the available checkout agreements. Each agreement has a name and the mode (manual or automatic).
const getCheckoutAgreements = async (): Promise<CheckoutAgreement[]>Events
Does not emit any drop-in events.
Returns
Returns an array of CheckoutAgreement objects.
getNegotiableQuote
The getNegotiableQuote function retrieves a negotiable quote for B2B customers. The function calls the negotiableQuote query.
const getNegotiableQuote = async ( input: GetNegotiableQuoteInput = {}): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | GetNegotiableQuoteInput | No | Input parameters including the quote UID to retrieve. |
Events
Does not emit any drop-in events.
Returns
Returns void.
getStoreConfig
The storeConfig query defines information about a store’s configuration. You can query a non-default store by changing the header in your GraphQL request.
const getStoreConfig = async (): Promise<any>Events
Does not emit any drop-in events.
Returns
Returns void.
isEmailAvailable
The isEmailAvailable function calls the isEmailAvailable query.
const isEmailAvailable = async ( email: string): Promise<EmailAvailability>| Parameter | Type | Req? | Description |
|---|---|---|---|
email | string | Yes | A string representing the email address to check for availability. |
Events
Does not emit any drop-in events.
Returns
Returns EmailAvailability.
setBillingAddress
The setBillingAddress function calls the setBillingAddressOnCart mutation.
const setBillingAddress = async ( input: BillingAddressInputModel): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | BillingAddressInputModel | Yes | The billing address to set on the cart, including street, city, region, country, and postal code. |
Events
Does not emit any drop-in events.
Returns
Returns void.
setGuestEmailOnCart
The setGuestEmailOnCart function calls the setGuestEmailOnCart mutation.
const setGuestEmailOnCart = async ( email: string): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
email | string | Yes | The guest customer’s email address for order confirmation and communication. |
Events
Does not emit any drop-in events.
Returns
Returns void.
setPaymentMethod
The setPaymentMethod function calls the setPaymentMethodOnCart mutation.
const setPaymentMethod = async ( input: PaymentMethodInputModel): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | PaymentMethodInputModel | Yes | The payment method code and additional payment data required by the selected payment processor. |
Events
Does not emit any drop-in events.
Returns
Returns void.
setShippingAddress
The setShippingAddress function calls the setShippingAddressesOnCart mutation.
const setShippingAddress = async ( input: ShippingAddressInputModel): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | ShippingAddressInputModel | Yes | The shipping address to set on the cart, including street, city, region, country, and postal code. |
Events
Does not emit any drop-in events.
Returns
Returns void.
setShippingMethods
The setShippingMethods function sets one or more shipping methods on the cart. The function calls the setShippingMethodsOnCart mutation.
const setShippingMethods = async ( input: Array<ShippingMethodInputModel>): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | Array<ShippingMethodInputModel> | Yes | An array of shipping method objects, each containing a carrier code and method code. |
Events
Does not emit any drop-in events.
Returns
Returns void.
Data Models
The following data models are used by functions in this drop-in.
Cart
The Cart object is returned by the following functions: getCart.
interface Cart { availablePaymentMethods?: PaymentMethod[]; billingAddress?: CartAddress; email?: string; id: string; isEmpty: boolean; isGuest: boolean; isVirtual: boolean; selectedPaymentMethod?: PaymentMethod; shippingAddresses: CartShippingAddress[];}CheckoutAgreement
The CheckoutAgreement object is returned by the following functions: getCheckoutAgreements.
interface CheckoutAgreement { content: AgreementContent; id: number; mode: AgreementMode; name: string; text: string;}EmailAvailability
The EmailAvailability object is returned by the following functions: isEmailAvailable.
type EmailAvailability = boolean;ShippingMethod
The ShippingMethod object is returned by the following functions: estimateShippingMethods.
type ShippingMethod = { amount: Money; carrier: Carrier; code: string; title: string; value: string; amountExclTax?: Money; amountInclTax?: Money;};