Skip to content

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.

Version: 2.1.0
FunctionDescription
estimateShippingMethodsCalls the estimateShippingMethods mutation..
getCartRetrieves the current cart’s checkout data from Adobe Commerce.
getCheckoutAgreementsReturns a list with the available checkout agreements.
getNegotiableQuoteRetrieves a negotiable quote for B2B customers.
getStoreConfigThe storeConfig query defines information about a store’s configuration.
isEmailAvailableCalls the isEmailAvailable query..
setBillingAddressCalls the setBillingAddressOnCart mutation..
setGuestEmailOnCartCalls the setGuestEmailOnCart mutation..
setPaymentMethodCalls the setPaymentMethodOnCart mutation..
setShippingAddressCalls the setShippingAddressesOnCart mutation..
setShippingMethodsSets one or more shipping methods on the cart.

estimateShippingMethods

The estimateShippingMethods function calls the estimateShippingMethods mutation.

const estimateShippingMethods = async (
input?: EstimateShippingInput
): Promise<ShippingMethod[] | undefined>
ParameterTypeReq?Description
inputEstimateShippingInputNoAn 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>
ParameterTypeReq?Description
inputGetNegotiableQuoteInputNoInput 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>
ParameterTypeReq?Description
emailstringYesA 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>
ParameterTypeReq?Description
inputBillingAddressInputModelYesThe 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>
ParameterTypeReq?Description
emailstringYesThe 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>
ParameterTypeReq?Description
inputPaymentMethodInputModelYesThe 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>
ParameterTypeReq?Description
inputShippingAddressInputModelYesThe 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>
ParameterTypeReq?Description
inputArray<ShippingMethodInputModel>YesAn 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;
};