[System] You are a VTEX documentation expert. You provide accurate, detailed information about VTEX platform, APIs, apps, and Store Framework development.

[User] Provide a guide on guides vtexjs for checkout in VTEX.

[Assistant]
Documentation

[Feedback](https://read.calvincode.net/reader?url=https://docs.google.com/forms/d/e/1FAIpQLSfmnotPvPjw-SjiE7lt2Nt3RQgNUe10ixXZmuO2v9enOJReoQ/viewform?entry.1972292648=developers.vtex.com%26entry.1799503232=)

[GuidesLearn how to use our APIs and extend the VTEX platform.](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides)

[API ReferenceExplore detailed information about our endpoints.](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/api-reference)

[App DevelopmentLearn how to build cloud-based apps and integrations.](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/app-development)

[Storefront DevelopmentExpress your brand identity creating unique storefronts.](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/storefront-development)

[VTEX IO AppsFind pre-built solutions to grow your business.](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/vtex-io-apps)

[TroubleshootingFind practical solutions to common development issues.](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/troubleshooting)

[Release NotesStay up to date with our latest releases and bug fixes.](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/updates/release-notes)

Guides

[VTEX Platform Overview](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtex-platform-overview)

---

[API usage](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/api-usage)

---

[Getting started](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/getting-started)

---

Integration Guides

---

[Catalog](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/catalog-integration)

---

[Checkout](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/checkout-api-overview)

---

[Master Data](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/master-data)

---

Payments

---

Orders

---

Logistics

---

B2B Suite

---

VTEX Sales App

---

UI Customization

[My Authentication](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/ui-customization-my-authentication)

[vtex.js](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs)

[vtex.js for Checkout](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout)

[vtex.js for Catalog](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-catalog)

---

Message Center

---

Pricing

---

Promotions

---

Infrastructure

---

Search

---

Storefront Permissions

---

[VTEX Activity Flow](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/activity-flow)

---

[VTEX Ads](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtex-ads)

---

VTEX Session

---

VTEX Shield

---

[Data Protection Plus](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/data-protection-plus)

---

Weni by VTEX

---

[Guides](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides)

[API Reference](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/api-reference)

[App Development](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/app-development)

[Storefront Development](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/storefront-development)

[VTEX IO Apps](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/vtex-io-apps)

[Troubleshooting](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/troubleshooting)

---

[Release Notes](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/updates/release-notes)

Guides

[VTEX Platform Overview](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtex-platform-overview)

---

[API usage](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/api-usage)

---

[Getting started](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/getting-started)

---

Integration Guides

---

[Catalog](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/catalog-integration)

---

[Checkout](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/checkout-api-overview)

---

[Master Data](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/master-data)

---

Payments

---

Orders

---

Logistics

---

B2B Suite

---

VTEX Sales App

---

UI Customization

[My Authentication](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/ui-customization-my-authentication)

[vtex.js](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs)

[vtex.js for Checkout](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout)

[vtex.js for Catalog](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-catalog)

---

Message Center

---

Pricing

---

Promotions

---

Infrastructure

---

Search

---

Storefront Permissions

---

[VTEX Activity Flow](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/activity-flow)

---

[VTEX Ads](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtex-ads)

---

VTEX Session

---

VTEX Shield

---

[Data Protection Plus](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/data-protection-plus)

---

Weni by VTEX

---

[Guides](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides)

UI Customization

[vtex.js](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs)

[vtex.js for Checkout](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout)

vtex.js for Checkout

The Checkout module handles customer purchase information.

Checkout adds different details needed to create an order, such as customer profile, address, shipping, and item information.

The OrderForm is the structure that contains this clustered data. It has several sections, each with helpful information that can be accessed, manipulated, and changed. To learn more, read the [OrderForm documentation](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/orderform-fields).

## Behavior of successive API requests

The `checkout` module encapsulates all requests that modify the orderForm and adds a cancellation behavior for subsequent requests.

Thus, subsequent requests to perform the same operation cause the `abort` of the previous request for the same operation. This means that if 3 successive requests are made for the same operation, the first 2 will be aborted, and only the third will be considered. For this reason, if more than one consumer uses the same Checkout instance, requests may be unintentionally aborted.

Consider the following scenario:

* Application A creates variable API = new vtexjs.Checkout()
* Plugin B uses API.sendAttachment() to send an address
* Plugin C uses API.sendAttachment() to simultaneously send another address
* Result: Call from B will be aborted and replaced with the call from C. This is expected. However, if Plugin B is waiting for the resolution of the call promise (e.g., using done()), it will never be successful because the request "failed" (was aborted).

There are two ways to solve this situation:

* Each plugin uses its Checkout instance, e.g., var APIInternaDoPluginA = new vtexjs.Checkout().
* The `orderFormUpdated.vtex` event handler is used to receive success notifications for Checkout modifications.

We recommend using `extended-ajax.js` (used by default in the bundle). With that, all requests are queued, so they do not happen in parallel.

## Events

### `orderFormUpdated.vtex [orderForm]`

When a call updates the orderForm, the orderFormUpdated.vtex event is fired. This is useful for different components that use vtex.js to stay updated without knowing the other present components.

**Important**: This event is only sent when the last pending request is finished. So, if multiple consecutive calls to the API are queued, the event will only be sent at the end of the last call.

### `checkoutRequestBegin.vtex [ajaxOptions]`

When any request that changes the orderForm is started, this event is fired. It can be used, for example, to initiate a load on the screen and prevent the user from making further modifications. The ajaxOptions parameter is the option object originally used to initiate this request.

### `checkoutRequestEnd.vtex [orderForm|jqXHR]`

When any request that changes the orderForm is finished, _with or without success_, this event is fired. Note that the argument can be an `orderForm` on success, or `jqXHR` in case of failure. It is not recommended to use this request to detect changes in the orderForm. Instead, use `orderFormUpdated.vtex`.

## expectedOrderFormSections

You will notice that most methods require an `expectedOrderFormSections` argument.

The orderForm is made up of several sections (or attachments). You can request that only a few be sent in the response.

This primarily improves performance when you know your call will not affect the sections you did not ask for, or if you do not mind the changes.

In general, it is safe not to send this argument, in which case all sections will be required.

You can see a description of each section by taking a look at the `_allOrderFormSections` property.

Given this explanation, this argument will no longer be detailed in the method documentation.

### Example

`1

$(window).on("orderFormUpdated.vtex", function(evt, orderForm) {

2

 alert("Someone changed the orderForm!")

3

 console.log(orderForm)

4

})

`

## getOrderForm(expectedOrderFormSections

Gets the current orderForm.

This is one of the most important methods. It is essential to make sure that an orderForm is available before making calls to change it.

### Returns

`Promise` for the orderForm.

### Example

`1

vtexjs.checkout.getOrderForm().done(function(orderForm) {

2

 console.log(orderForm)

3

})

`

## sendAttachment(attachmentId, attachment, expectedOrderFormSections

Sends an attachment to the current orderForm. (An attachment is a section.)

This makes it possible to update this section by sending new information, making changes, or removing something.

> You must send the complete attachment. See examples.

Read the [OrderForm documentation](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/orderform-fields) to learn more about sections.

Do not forget to use `getOrderForm` first.

### Returns

`Promise` for the orderForm.

### Arguments

| Name         | Type                                                     |
| ------------ | -------------------------------------------------------- |
| attachmentId | String containing the name of the attachment being sent. |
| attachment   | Object containing the attachment.                        |

### Examples

#### Change clientProfileData

If you want to change the customer's first name, change the property `firstName` in `clientProfileData`.

`1

vtexjs.checkout

2

 .getOrderForm()

3

 .then(function(orderForm) {

4

 var clientProfileData = orderForm.clientProfileData

5

 clientProfileData.firstName = William

6

 return vtexjs.checkout.sendAttachment(

7

 "clientProfileData",

8

 clientProfileData

9

 )

10

 })

11

 .done(function(orderForm) {

12

 alert("Name changed!")

13

 console.log(orderForm)

14

 console.log(orderForm.clientProfileData)

15

 })

`

#### Change openTextField

The openTextField is a field for comments. Read the [OrderForm documentation](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/orderform-fields) for more information.

`1

vtexjs.checkout

2

 .getOrderForm()

3

 .then(function(orderForm) {

4

 var obs = "No onion!"

5

 return vtexjs.checkout.sendAttachment("openTextField", { value: obs })

6

 })

7

 .done(function(orderForm) {

8

 console.log("openTextField filled with: ", orderForm.openTextField)

9

 })

`

## addToCart(items, expectedOrderFormSections, salesChannel)

Add items to the orderForm.

> This method does not automatically apply to promotions through UTM. To add promotions using UTM, do a `sendAttachment` of `marketingData` with the required information.

An item to be added is necessarily composed of: `id`, `quantity`, and `seller`. The `id` property can be obtained from the [Catalog](https://read.calvincode.net/reader?url=https://developers.vtex.com/vtex-rest-api/docs/vtexjs-for-catalog) by looking at the ItemId of the item in the product item array.

Items that are already in the orderForm will remain unchanged.

### Returns

`Promise` for the orderForm.

### Arguments

| Name         | Type                                                                                |
| ------------ | --------------------------------------------------------------------------------------------------------------------- |
| items        | Array containing the set of items that will be added. Even if there is only one item, it must be wrapped in an array. |
| salesChannel | Number or String(Optional parameter, default = 1).                                                                    |

### Example

Add an item with itemId 2000017893 from sales channel 3.

`1

var item = {

2

 id: 2000017893,

3

 quantity: 1,

4

 seller: "1",

5

}

6

vtexjs.checkout.addToCart([item], null, 3).done(function(orderForm) {

7

 alert("Item added!")

8

 console.log(orderForm)

9

})

`

## updateItems(items, expectedOrderFormSections)

Updates items in the orderForm.

An item is identified by its `index` property. In the orderForm, this property can be obtained by looking at the item index in the item array.

Read the [OrderForm documentation](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/orderform-fields) to learn more about the item object.

Properties and orderForm items that are not sent, will remain unchanged.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Arguments

| Name      | Type                                                                                |
| --------- | ----------------------------------------------------------------------------------------------------------------------------- |
| items     | Array containing the set of items that will be updated. Even if there is only one item, it must be wrapped in an array.       |
| splitItem | Boolean default: true. Indicates if a separate item should be created when the items to be updated have attachments/services. |

### Example

Change the quantity and the seller of the first item.

`1

vtexjs.checkout

2

 .getOrderForm()

3

 .then(function(orderForm) {

4

 var itemIndex = 0

5

 var item = orderForm.items[itemIndex]

6

 var updateItem = {

7

 index: itemIndex,

8

 quantity: 5,

9

 }

10

 return vtexjs.checkout.updateItems([updateItem], null, false)

11

 })

12

 .done(function(orderForm) {

13

 alert("Items updated!")

14

 console.log(orderForm)

15

 })

`

## removeItems(items, expectedOrderFormSections)

Removes items from the orderForm.

An item is identified by its `index` property. In the orderForm, this property can be obtained by looking at the item index in the item array.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Arguments

| Name  | Type                                                                                |
| ----- | ----------------------------------------------------------------------------------------------------------------------- |
| items | Array containing the set of items that will be removed. Even if there is only one item, it must be wrapped in an array. |

### Example

Remove the first item.

`1

vtexjs.checkout

2

 .getOrderForm()

3

 .then(function(orderForm) {

4

 var itemIndex = 0

5

 var item = orderForm.items[itemIndex]

6

 var itemsToRemove = [

7

 {

8

 index: 0,

9

 quantity: 0,

10

 },

11

 ]

12

 return vtexjs.checkout.removeItems(itemsToRemove)

13

 })

14

 .done(function(orderForm) {

15

 alert("Item removed!")

16

 console.log(orderForm)

17

 })

`

## removeAllItems(expectedOrderFormSections)

Removes all items from the orderForm.

Do not forget to use getOrderForm first.

### **Returns**

`Promise` for the orderForm.

### Example

`1

vtexjs.checkout.removeAllItems()

2

.done(function(orderForm) {

3

alert('Empty cart.');

4

console.log(orderForm);

5

});

`

## cloneItem(itemIndex, newItemsOptions, expectedOrderFormSections)

Creates one or more items in the cart based on another item. The item to be cloned must have an attachment.

An item is identified by its `index` property. In the orderForm, this property can be obtained by looking at the item index in the item array.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Arguments

| Name            | Type                                                                           |
| --------------- | ------------------------------------------------------------------------------ |
| itemIndex       | Index number of the item to which the offer is applied.                        |
| newItemsOptions | Array (optional) with the properties that should be assigned to the new items. |

### Example

Create a new item based on the item with index 0.

`1

var itemIndex = 0;

2

3

vtexjs.checkout.cloneItem(itemIndex)

4

 .done(function(orderForm) {

5

 console.log(orderForm);

6

 });

`

Create a new item based on an item with index 0, quantity 2, and an attachment already configured.

`1

var itemIndex = 0

2

var newItemsOptions = [

3

 {

4

 itemAttachments: [

5

 {

6

 name: "Customization",

7

 content: {

8

 Name: "Robert",

9

 },

10

 },

11

 ],

12

 quantity: 2,

13

 },

14

]

15

16

vtexjs.checkout.cloneItem(itemIndex, newItemsOptions).done(function(orderForm) {

17

 console.log(orderForm)

18

})

`

## calculateShipping(address)

Receives an address and records it in the user's shippingData.

The effect is that the shipping will be calculated and available in one of the orderForm totalizers.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Arguments

| Name    | Type                                                                                |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| address | Object containing the address that must have at least postalCode and country. From these two properties, the others will be inferred. |

### Example

`1

vtexjs.checkout.getOrderForm()

2

 .then(function(orderForm) {

3

 var postalCode = '22250-040'; // no hyphen is also OK

4

 var country = 'BRA';

5

 var address = {

6

 "postalCode": postalCode,

7

 "country": country

8

 };

9

 return vtexjs.checkout.calculateShipping(address)

10

 })

11

 .done(function(orderForm) {

12

 alert(Shipping calculated.');

13

 console.log(orderForm.shippingData);

14

 console.log(orderForm.totalizers);

15

 });

`

## simulateShipping(items, postalCode, country, salesChannel) \[DEPRECATED\]

Receives an item list, postalCode, and country and simulates the shipping of these items for this address.

The difference from `calculateShipping` is that this call is isolated. It can be used for an arbitrary set of items and does not bind the address to the user.

The result of this simulation includes the different carriers that can be used for each item, including name, delivery date, and price.

It is ideal for simulating shipping on the product page.

### Returns

Promise with the result. The result has the property logisticsInfo.

### Arguments

| Name         | Type                                                                      |
| ------------ | ------------------------------------------------------------------------- |
| items        | Array of objects that have at least ID, quantity, and seller.             |
| postalCode   | String with the postal code. (CEP for Brazil.)                            |
| country      | String with the three-letter country code. For example, "BRA" for Brazil. |
| salesChannel | Number or string. (Optional parameter, default = 1.)                      |

### Example

`` 1

// `Items` must be an array of objects containing at least the information below

2

var items = [

3

 {

4

 id: 5987, // item sku

5

 quantity: 1,

6

 seller: "1",

7

 },

8

]

9

10

// For Brazil, `postalCode` must be the customer's CEP

11

var postalCode = "22250-040"

12

// This also works

13

// var postalCode = '22250040';

14

15

// `country` must be the 3-letter country code

16

var country = "BRA"

17

18

vtexjs.checkout

19

 .simulateShipping(items, postalCode, country)

20

 .done(function(result) {

21

 /* `result.logisticsInfo` is an array of objects.

22

 Each object corresponds to the logistics information (shipping) for each item in the order in which the items were sent.

23

 For example, `result.logisticsInfo[0].slas` will contain different carrier options (with deadline and price) for the first item.

24

 For more details, check the orderForm documentation.

25

 */

26

})

 ``

## simulateShipping(shippingData, orderFormId, country, salesChannel)

Receives an object containing shipping information (`shippingData`), the `orderFormId`, and `country`, and simulates the shipping of these items for this address.

The difference from `calculateShipping` is that this call receives different parameters to get the same result.

This is an overloaded function.

The result of this simulation is the same as the last one; it returns different carriers that can be used for each item, including name, delivery date, and price.

### Returns

Promise for the result. The result has the property `logisticsInfo`.

### Arguments\*\*

| Name         | Type                                                                                |
| ------------ | -------------------------------------------------------------------------------------------- |
| shippingData | Object containing shipping and item information through logisticsInfo and selectedAddresses. |
| orderFormId  | String representing the ID of the current session's orderForm.                               |
| country      | String with the three-letter country code. For example, "BRA" for Brazil.                    |
| salesChannel | Number or string. (Optional parameter, default = 1.)                                         |

### Example

`` 1

// `logisticsInfo` must be an array of logisticsInfo objects and contain at least one selectedAddresses

2

var shippingData = [

3

 {

4

 logisticsInfo: logisticsInfoList,

5

 selectedAddresses: selectedAddressesList,

6

 },

7

]

8

9

// `orderFormId` must be an ID of the session's orderForm

10

var orderFormId = "9f879d435f8b402cb133167d6058c14f"

11

12

// `country` must be the 3-letter country code

13

var country = "BRA"

14

15

vtexjs.checkout

16

 .simulateShipping(items, postalCode, country)

17

 .done(function(result) {

18

 /* `result.logisticsInfo` is an array of objects.

19

 Each object corresponds to the logistics information (shipping) for each item in the order in which the items were sent.

20

 For example, `result.logisticsInfo[0].slas` contains the different carrier options (with deadline and price) for the first item.

21

 For more details, check the orderForm documentation.

22

 */

23

})

 ``

## getAddressInformation(address)

Given an incomplete address with postalCode and country, returns a complete address with city, state, street, and any other available information.

### Returns

`Promise` for the complete address.

### Arguments

| Name    | Type                                                                                |
| ------- | ------------------------------------------------------------------------------------------------------------------------------- |
| address | Object with the address that must have at least postalCode and country. With these two properties, the others will be inferred. |

### Example

`` 1

// For Brazil, `postalCode` must be the customer's CEP

2

var postalCode = "22250-040"

3

// No hyphen also works

4

// var postalCode = '22250040';

5

6

// `country` must be the 3-letter country abbreviation

7

var country = "BRA"

8

9

var address = {

10

 postalCode: postalCode,

11

 country: country,

12

}

13

14

vtexjs.checkout.getAddressInformation(address).done(function(result) {

15

 console.log(result)

16

})

 ``

## getProfileByEmail(email, salesChannel)

Performs partial user login using email.

The information will likely come masked, and you will not be able to edit it if the user already exists. For this, you need to authenticate with VTEX ID. You can check through the canEditData property of the orderForm. For more information, read the [OrderForm documentation](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/orderform-fields).

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### **Arguments**

| Name         | Type                            |
| ------------ | ------------------------------- |
| email        | String                          |
| salesChannel | Number or string (default = 1). |

### Example

`1

vtexjs.checkout

2

 .getOrderForm()

3

 .then(function(orderForm) {

4

 var email = "example@vtex.com"

5

 return vtexjs.checkout.getProfileByEmail(email)

6

 })

7

 .done(function(orderForm) {

8

 console.log(orderForm)

9

 })

`

## removeAccountId(accountId, expectedOrderFormSections)

In orderForm.paymentData.availableAccounts, you find the user's payment accounts. Each account has several details, one of which is the accountId. This ID can be used in this method for removing the payment account.

Do not forget to use getOrderForm first.

### Returns

`Promise` of success.

### Arguments

| Name      | Type   |
| --------- | ------ |
| accountId | String |

### Example

`1

vtexjs.checkout

2

 .getOrderForm()

3

 .then(function(orderForm) {

4

 var accountId = orderForm.paymentData.availableAccounts[0].accountId

5

 return vtexjs.checkout.removeAccountId(accountId)

6

 })

7

 .then(function() {

8

 alert("Removed.")

9

 })

`

## addDiscountCoupon(couponCode, expectedOrderFormSections)

Adds a discount coupon to the orderForm.

Only one discount coupon can be applied per purchase.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Arguments

| Name       | Type   |
| ---------- | ------ |
| couponCode | String |

### Example

`1

vtexjs.checkout

2

 .getOrderForm()

3

 .then(function(orderForm) {

4

 var code = "ABC123"

5

 return vtexjs.checkout.addDiscountCoupon(code)

6

 })

7

 .then(function(orderForm) {

8

 alert("Coupon added.")

9

 console.log(orderForm)

10

 console.log(orderForm.paymentData)

11

 console.log(orderForm.totalizers)

12

 })

`

## removeDiscountCoupon(expectedOrderFormSections)

Removes the orderForm discount coupon.

Only one discount coupon can be applied per purchase. Therefore, there is no need to specify anything here.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Example

`1

vtexjs.checkout

2

 .getOrderForm()

3

 .then(function(orderForm) {

4

 return vtexjs.checkout.removeDiscountCoupon()

5

 })

6

 .then(function(orderForm) {

7

 alert("Coupon removed.")

8

 console.log(orderForm)

9

 console.log(orderForm.paymentData)

10

 console.log(orderForm.totalizers)

11

 })

`

## removeGiftRegistry(expectedOrderFormSections)

Removes the gift registry from the orderForm.

This unlinks the gift list to which the orderForm is associated, if any. If it is not linked, it does not do anything.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Example

`1

vtexjs.checkout

2

 .getOrderForm()

3

 .then(function(orderForm) {

4

 return vtexjs.checkout.removeGiftRegistry()

5

 })

6

 .then(function(orderForm) {

7

 alert("Gift list removed.")

8

 console.log(orderForm)

9

 })

`

## addOffering(offeringId, itemIndex, expectedOrderFormSections)

Adds an offer to the orderForm.

Each orderForm item may have a list of `offerings`. These offers are linked to the item, like extended warranty or installation service.

When an offer is added, it will appear in the item's `bundleItems` field.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Arguments

| Name       | Type                                                                 |
| ---------- | -------------------------------------------------------------------- |
| offeringId | String or number. This may be found in the id property of the offer. |
| itemIndex  | Number. The index of the item to which the offer is applied.         |

### Example

`1

// Considering the following (summarized) structure of items:

2

var items = [

3

 {

4

 id: "2004075",

5

 productId: "4741",

6

 name: "Dog food",

7

 skuName: "3 kg Dog Food",

8

 quantity: 3,

9

 seller: "1",

10

 bundleItems: [],

11

 offerings: [

12

 {

13

 id: "1033",

14

 name: "The Magnificent Offer",

15

 price: 100,

16

 type: "idk",

17

 },

18

 ],

19

 availability: "available",

20

 },

21

]

22

23

var offeringId = items[0].offerings[0].id

24

var itemIndex = 0

25

26

vtexjs.checkout

27

 .getOrderForm()

28

 .then(function() {

29

 return vtexjs.checkout.addOffering(offeringId, itemIndex)

30

 })

31

 .done(function(orderForm) {

32

 // Offer added!

33

 console.log(orderForm)

34

 })

`

## removeOffering(offeringId, itemIndex, expectedOrderFormSections)

Removes an offer.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Arguments

| Name       | Type                                                            |
| ---------- | --------------------------------------------------------------- |
| offeringId | String or number. This may be found in the offer's id property. |
| itemIndex  | Number. The index of the item to which the offer is applied.    |

### Example

`1

// Considering the following (summarized) structure of items:

2

var items = [

3

 {

4

 id: "2004075",

5

 productId: "4741",

6

 name: "Dog Food",

7

 skuName: "3 kg Dog Food",

8

 quantity: 3,

9

 seller: "1",

10

 bundleItems: [

11

 {

12

 id: "1033",

13

 name: "The Magnificent Offer",

14

 price: 100,

15

 type: "idk",

16

 },

17

 ],

18

 offerings: [

19

 {

20

 id: "1033",

21

 name: "The Magnificent Offer",

22

 price: 100,

23

 type: "idk",

24

 },

25

 ],

26

 availability: "available",

27

 },

28

]

29

30

var offeringId = items[0].bundleItems[0].id

31

var itemIndex = 0

32

33

vtexjs.checkout

34

 .getOrderForm()

35

 .then(function() {

36

 return vtexjs.checkout.removeOffering(offeringId, itemIndex)

37

 })

38

 .done(function(orderForm) {

39

 // Offer removed!

40

 console.log(orderForm)

41

 })

`

## addItemAttachment(itemIndex, attachmentName, content, expectedOrderFormSections, splitItem)

This method adds an attachment to an item in the cart. This allows you to add extra information to the item.

You can link an attachment to the SKU through the admin interface. To see which attachments can be inserted, check the item's `attachmentOfferings` property.

For example, when adding a sports team shirt to the cart, you can add the 'customization' attachment to allow the customer to choose the number that will be printed on the shirt.

If the attachment has more than one property in its object, you must send the complete object even if you only changed one field.

Example

The item has an attachmentOffering as follows:

`1

"attachmentOfferings": [{

2

 "name": "Customization",

3

 "required": true,

4

 "schema": {

5

 "Name": {

6

 "maximumNumberOfCharacters": 20,

7

 "domain": []

8

 },

9

 "Number": {

10

 "maximumNumberOfCharacters": 20,

11

 "domain": []

12

 }

13

 }

14

}],

`

The content object must always send all its properties:

`1

var itemIndex = 0

2

var attachmentName = Customization

3

4

// User entered the value for the Name field. The object must also pass the Number field.

5

var content = { Name: Robert, Number: "" }

6

7

vtexjs.checkout.addItemAttachment(

8

 itemIndex,

9

 attachmentName,

10

 content,

11

 null,

12

 false

13

)

`

Do not forget to call getOrderForm at least once before.

### Returns

`Promise` for the orderForm.

### Arguments

| Name           | Type                                                                                |
| -------------- | -------------------------------------------------------------------------------------------------------------------- |
| itemIndex      | Number. The index of the item that will be included in the attachment.                                               |
| attachmentName | String that can be found in the name property of attachmentOfferings in the item object.                             |
| content        | Object. An object that follows the schema described in the schema property of attachmentOfferings.                   |
| splitItem      | Boolean default: true. Indicates that a separate item should be created if the items to be updated have attachments. |

### Example

`1

// Called sometime before

2

// vtexjs.checkout.getOrderForm()

3

4

var itemIndex = 0

5

var attachmentName = "Customization"

6

var content = {

7

 Name: Robert,

8

 Numero: "10",

9

}

10

11

vtexjs.checkout

12

 .addItemAttachment(itemIndex, attachmentName, content)

13

 .done(function(orderForm) {

14

 // Attachment added to the item!

15

 console.log(orderForm)

16

 })

`

### Possible errors

404: The item does not have this linked `attachment` or the `content` object has an invalid property. 400: The `content` object was not passed correctly.

If the call fails, check the error object returned: `(error.message)`. This will give you clues about what is wrong in the call.

## **removeItemAttachment(itemIndex, attachmentName, content, expectedOrderFormSections)**

Removes an item attachment from the cart.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Arguments

| Name           | Type                                                                                |
| -------------- | -------------------------------------------------------------------------------------------------- |
| itemIndex      | Number. The index of the item that will be included in the attachment.                             |
| attachmentName | String that can be found in the name property of attachmentOfferings in the item object.           |
| content        | Object. An object that follows the schema described in the schema property of attachmentOfferings. |

## addBundleItemAttachment(itemIndex, bundleItemId, attachmentName, content, expectedOrderFormSections)

This method adds an attachment to the service (bundleItem) of an item in the cart.

You can link an attachment to the service through the admin interface. To see which attachments can be inserted, check the attachmentOfferings property of the service.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Arguments

| Name           | Type                                                                                |
| -------------- | -------------------------------------------------------------------------------------------------- |
| itemIndex      | Number. The index of the item to which the service is applied.                                     |
| bundleId       | String or number. This may be found in the id property of the bundleItem.                          |
| attachmentName | String that can be found in the name property of attachmentOfferings in the service object.        |
| content        | Object. An object that follows the schema described in the schema property of attachmentOfferings. |

### Example

`1

var itemIndex = 0

2

var bundleItemId = 5

3

var attachmentName = "message"

4

var content = {

5

 text: "Congratulations!",

6

}

7

8

vtexjs.checkout

9

 .getOrderForm()

10

 .then(function() {

11

 return vtexjs.checkout.addBundleItemAttachment(

12

 itemIndex,

13

 bundleItemId,

14

 attachmentName,

15

 content

16

 )

17

 })

18

 .done(function(orderForm) {

19

 // Attachment added to the item!

20

 console.log(orderForm)

21

 })

`

## removeBundleItemAttachment(itemIndex, bundleItemId, attachmentName, content, expectedOrderFormSections)

Removes an attachment from a service.

Do not forget to use getOrderForm first.

### Returns

`Promise` for the orderForm.

### Arguments

| Name           | Type                                                                                |
| -------------- | ------------------------------------------------------------------------------------------- |
| itemIndex      | Number. The index of the item to which the service is applied.                              |
| bundleId       | String ou Number May be found in the id property of the bundleItem                          |
| attachmentName | String that can be found in the name property of attachmentOfferings in the service object. |
| content        | An object that follows the schema described in the schema property of attachmentOfferings.  |

## sendLocale(locale)

Changes the user locale.

This causes a change in the orderForm, in `clientPreferencesData`.

Do not forget to use getOrderForm first.

### Returns

`Promise` of success (no orderForm section is requested).

### Arguments

| Name   | Type                               |
| ------ | ---------------------------------- |
| locale | String examples: "pt-BR", "en-US". |

### Example

`1

vtexjs.checkout

2

 .getOrderForm()

3

 .then(function(orderForm) {

4

 return vtexjs.checkout.sendLocale("en-US")

5

 })

6

 .then(function() {

7

 alert("Now you're an American ;)")

8

 })

`

## clearMessages(expectedOrderFormSections)

Occasionally, the orderForm has its `messages` section populated with informational or error messages.

To clear the messages, use this method.

Do not forget to use getOrderForm first.

### Returns

`Promise` of success (no orderForm section is requested).

### Example

`1

vtexjs.checkout

2

 .getOrderForm()

3

 .then(function(orderForm) {

4

 return vtexjs.checkout.clearMessages()

5

 })

6

 .then(function() {

7

 alert("Messages cleaned.")

8

 })

`

## getLogoutURL()

This method returns a URL that logs the user out, but keeps their cart.

You are responsible for making this redirection.

Do not forget to use getOrderForm first.

### Returns

`String`

### Example

`1

$(".logout").on("click", function() {

2

 vtexjs.checkout.getOrderForm().then(function(orderForm) {

3

 var logoutURL = vtexjs.checkout.getLogoutURL()

4

 window.location = logoutURL

5

 })

6

})

`

## getOrders(orderGroupId)

Gets the orders (order) contained in an order group (orderGroup).

If an order has been finalized and fulfilled by multiple sellers, it will be split into several orders — one for each seller.

The orderGroupId looks like `v50123456abc`, while group orders have identifiers such as `v50123456abc-01`, `v50123456abc-02`.

In most cases, an orderGroup will only contain one order.

In terms of data, an orderGroup is an array of order objects. An order has several properties related to the completion of the purchase. Full documentation of this object will be available soon.

### Returns

`Promise` for the orders.

### Arguments

| Name         | Type   |
| ------------ | ------ |
| orderGroupId | String |

### Example

`1

var orderGroupId = "v50123456abc"

2

vtexjs.checkout.getOrders(orderGroupId).then(function(orders) {

3

 console.log("Number of orders in this group: ", orders.length)

4

 console.log(orders)

5

})

`

## changeItemsOrdination(criteria, ascending, expectedOrderFormSections)

Changes the sort order of the items based on the criteria (criteria) and an ascending parameter (ascending).

This causes a change in the `itemsOrdination` object of the `OrderForm` and also in the sort order of the objects in the `items` array.

### Returns

`Promise` for the orderForm.

### Arguments

| Name      | Type                                                   |
| --------- | ------------------------------------------------------ |
| criteria  | String name or add\_time                               |
| ascending | Boolean. True for increasing and false for decreasing. |

### Example

`1

var criteria = "add_time"

2

var asceding = "false"

3

vtexjs.checkout

4

 .changeItemsOrdination(criteria, ascending)

5

 .then(function(orderForm) {

6

 console.log("Sorting criteria: ", orderForm.itemsOrdination)

7

 console.log("Array of items sorted by criteria: ", orderForm.items)

8

 })

`

## replaceSKU(items, expectedOrderFormSections, splitItem)

Removes a SKU from a current item and replaces it with a new one.

### Returns

`Promise` for the orderForm.

### Arguments

| Name      | Type                                                                                |
| --------- | ------------------------------------------------------------------------------------------------------------------------ |
| items     | Array object with the SKU to be removed in quantity 0 and the new SKU to be added. Must be wrapped in an array.          |
| splitItem | Boolean default: true. Indicates a separate item should be created if the items to be updated have attachments/services. |

### Example

`1

var items = [

2

 {

3

 seller: "1",

4

 quantity: 0,

5

 index: 0,

6

 },

7

 {

8

 seller: "1",

9

 quantity: 1,

10

 id: "2",

11

 },

12

]

13

14

vtexjs.checkout.replaceSKU(items).then(function(orderForm) {

15

 console.log("New items: ", orderForm.items)

16

})

`

## finishTransaction(orderGroupId, expectedOrderFormSections)

Tells the Checkout API to finish a transaction and go to the final URL (e.g. `order-placed`, `checkout`).

### Returns

`Promise` for the orderForm.

### Arguments

| Name             | Type                                                                                |
| ---------------- | ----------------------------------------------------------------------------------- |
| **orderGroupId** | Number. ID of the order to be created after finishing the checkout process.\*\*\*\* |

### Example

`1

var orderGroupId = "959290226406"

2

3

vtexjs.checkout.finishTransaction(orderGroupId).then(function(response) {

4

 console.log("Success", response.status)

5

})

`

Contributors

2

[![Photo of the contributor](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/_next/image?url=https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F106821144%3Fv%3D4%26w=64%26q=75)](https://github.com/GeorgeLimaDev)

[![Photo of the contributor](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/_next/image?url=https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F7108339%3Fv%3D4%26w=64%26q=75)](https://github.com/brunoamui)

Was this helpful?

Yes

No

[Suggest Edits (GitHub)](https://read.calvincode.net/reader?url=https://github.com/vtexdocs/dev-portal-content/edit/main/docs/guides/UI-Customization/vtexjs/vtexjs-for-checkout.md)

[vtex.js« Previous](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout//docs/guides/vtexjs)[vtex.js for CatalogNext »](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout//docs/guides/vtexjs-for-catalog)

Contributors

2

[![Photo of the contributor](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/_next/image?url=https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F106821144%3Fv%3D4%26w=64%26q=75)](https://github.com/GeorgeLimaDev)

[![Photo of the contributor](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/_next/image?url=https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F7108339%3Fv%3D4%26w=64%26q=75)](https://github.com/brunoamui)

ON THIS PAGE

[Behavior of successive API requests](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23behavior-of-successive-api-requests)

[Events](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23events)

[orderFormUpdated.vtex \[orderForm\]](https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout#orderformupdatedvtex-orderform)[checkoutRequestBegin.vtex \[ajaxOptions\]](https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout#checkoutrequestbeginvtex-ajaxoptions)[checkoutRequestEnd.vtex \[orderForm|jqXHR\]](https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout#checkoutrequestendvtex-orderformjqxhr)

[expectedOrderFormSections](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23expectedorderformsections)

[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[getOrderForm(expectedOrderFormSections](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23getorderformexpectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[sendAttachment(attachmentId, attachment, expectedOrderFormSections](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23sendattachmentattachmentid-attachment-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Examples](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23examples)

[addToCart(items, expectedOrderFormSections, salesChannel)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23addtocartitems-expectedorderformsections-saleschannel)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[updateItems(items, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23updateitemsitems-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeItems(items, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removeitemsitems-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeAllItems(expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removeallitemsexpectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[cloneItem(itemIndex, newItemsOptions, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23cloneitemitemindex-newitemsoptions-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[calculateShipping(address)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23calculateshippingaddress)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[simulateShipping(items, postalCode, country, salesChannel) \[DEPRECATED\]](https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout#simulateshippingitems-postalcode-country-saleschannel-deprecated)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[simulateShipping(shippingData, orderFormId, country, salesChannel)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23simulateshippingshippingdata-orderformid-country-saleschannel)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments\*\*](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[getAddressInformation(address)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23getaddressinformationaddress)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[getProfileByEmail(email, salesChannel)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23getprofilebyemailemail-saleschannel)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeAccountId(accountId, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removeaccountidaccountid-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[addDiscountCoupon(couponCode, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23adddiscountcouponcouponcode-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeDiscountCoupon(expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removediscountcouponexpectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeGiftRegistry(expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removegiftregistryexpectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[addOffering(offeringId, itemIndex, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23addofferingofferingid-itemindex-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeOffering(offeringId, itemIndex, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removeofferingofferingid-itemindex-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[addItemAttachment(itemIndex, attachmentName, content, expectedOrderFormSections, splitItem)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23additemattachmentitemindex-attachmentname-content-expectedorderformsections-splititem)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)[Possible errors](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23possible-errors)

[removeItemAttachment(itemIndex, attachmentName, content, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removeitemattachmentitemindex-attachmentname-content-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)

[addBundleItemAttachment(itemIndex, bundleItemId, attachmentName, content, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23addbundleitemattachmentitemindex-bundleitemid-attachmentname-content-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeBundleItemAttachment(itemIndex, bundleItemId, attachmentName, content, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removebundleitemattachmentitemindex-bundleitemid-attachmentname-content-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)

[sendLocale(locale)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23sendlocalelocale)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[clearMessages(expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23clearmessagesexpectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[getLogoutURL()](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23getlogouturl)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[getOrders(orderGroupId)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23getordersordergroupid)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[changeItemsOrdination(criteria, ascending, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23changeitemsordinationcriteria-ascending-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[replaceSKU(items, expectedOrderFormSections, splitItem)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23replaceskuitems-expectedorderformsections-splititem)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[finishTransaction(orderGroupId, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23finishtransactionordergroupid-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

Was this helpful?

 Send feedback

[Suggest edits (GitHub)](https://read.calvincode.net/reader?url=https://github.com/vtexdocs/dev-portal-content/edit/main/docs/guides/UI-Customization/vtexjs/vtexjs-for-checkout.md)

Copy page

On this page

ON THIS PAGE

[Behavior of successive API requests](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23behavior-of-successive-api-requests)

[Events](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23events)

[orderFormUpdated.vtex \[orderForm\]](https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout#orderformupdatedvtex-orderform)[checkoutRequestBegin.vtex \[ajaxOptions\]](https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout#checkoutrequestbeginvtex-ajaxoptions)[checkoutRequestEnd.vtex \[orderForm|jqXHR\]](https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout#checkoutrequestendvtex-orderformjqxhr)

[expectedOrderFormSections](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23expectedorderformsections)

[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[getOrderForm(expectedOrderFormSections](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23getorderformexpectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[sendAttachment(attachmentId, attachment, expectedOrderFormSections](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23sendattachmentattachmentid-attachment-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Examples](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23examples)

[addToCart(items, expectedOrderFormSections, salesChannel)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23addtocartitems-expectedorderformsections-saleschannel)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[updateItems(items, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23updateitemsitems-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeItems(items, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removeitemsitems-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeAllItems(expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removeallitemsexpectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[cloneItem(itemIndex, newItemsOptions, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23cloneitemitemindex-newitemsoptions-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[calculateShipping(address)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23calculateshippingaddress)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[simulateShipping(items, postalCode, country, salesChannel) \[DEPRECATED\]](https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout#simulateshippingitems-postalcode-country-saleschannel-deprecated)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[simulateShipping(shippingData, orderFormId, country, salesChannel)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23simulateshippingshippingdata-orderformid-country-saleschannel)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments\*\*](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[getAddressInformation(address)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23getaddressinformationaddress)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[getProfileByEmail(email, salesChannel)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23getprofilebyemailemail-saleschannel)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeAccountId(accountId, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removeaccountidaccountid-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[addDiscountCoupon(couponCode, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23adddiscountcouponcouponcode-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeDiscountCoupon(expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removediscountcouponexpectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeGiftRegistry(expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removegiftregistryexpectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[addOffering(offeringId, itemIndex, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23addofferingofferingid-itemindex-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeOffering(offeringId, itemIndex, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removeofferingofferingid-itemindex-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[addItemAttachment(itemIndex, attachmentName, content, expectedOrderFormSections, splitItem)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23additemattachmentitemindex-attachmentname-content-expectedorderformsections-splititem)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)[Possible errors](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23possible-errors)

[removeItemAttachment(itemIndex, attachmentName, content, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removeitemattachmentitemindex-attachmentname-content-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)

[addBundleItemAttachment(itemIndex, bundleItemId, attachmentName, content, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23addbundleitemattachmentitemindex-bundleitemid-attachmentname-content-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[removeBundleItemAttachment(itemIndex, bundleItemId, attachmentName, content, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23removebundleitemattachmentitemindex-bundleitemid-attachmentname-content-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)

[sendLocale(locale)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23sendlocalelocale)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[clearMessages(expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23clearmessagesexpectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[getLogoutURL()](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23getlogouturl)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[getOrders(orderGroupId)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23getordersordergroupid)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[changeItemsOrdination(criteria, ascending, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23changeitemsordinationcriteria-ascending-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[replaceSKU(items, expectedOrderFormSections, splitItem)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23replaceskuitems-expectedorderformsections-splititem)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

[finishTransaction(orderGroupId, expectedOrderFormSections)](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23finishtransactionordergroupid-expectedorderformsections)

[Returns](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23returns)[Arguments](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23arguments)[Example](https://read.calvincode.net/reader?url=https://developers.vtex.com/docs/guides/vtexjs-for-checkout/docs/guides/vtexjs-for-checkout%23example)

On this page

[Github](https://read.calvincode.net/reader?url=https://github.com/vtex-apps)[Help Center](https://read.calvincode.net/reader?url=https://help.vtex.com/)[Community](https://read.calvincode.net/reader?url=https://community.vtex.com/?%5Fga=2.198523433.743584735.1647618303-1974737580.1645714642)[Feedback](https://read.calvincode.net/reader?url=https://docs.google.com/forms/d/e/1FAIpQLSfmnotPvPjw-SjiE7lt2Nt3RQgNUe10ixXZmuO2v9enOJReoQ/viewform?entry.1972292648=developers.vtex.com%26entry.1799503232=)