Skip to content

vtex-apps/order-items

Folders and files

NameName
Last commit message
Last commit date
Apr 16, 2021
Jul 19, 2022
Feb 27, 2025
Jul 19, 2022
Sep 5, 2024
Mar 11, 2020
Feb 19, 2020
Sep 22, 2020
Apr 14, 2021
Feb 19, 2020
Aug 14, 2019
Sep 5, 2024
Jul 19, 2022
Sep 5, 2024
Jul 19, 2022
Jul 19, 2022

Repository files navigation

Order Items

All Contributors

Centralizes all item related requests to the Checkout API.

Warning =¨

This repository contains experimental code for VTEX Checkout and should not be used in production.

This code is "experimental" for various reasons:

  • Some are not tested as rigorously as the main code.
  • Some are tested but not maintained.
  • It can suffer from significant changes (breaking changes) without further notice.

Use it at your own risk!

About

Any kind of item manipulation should be made through this component. This ensures that each interaction with the Checkout API happens in succession, avoiding concurrency issues.

This repository is an adapter of @vtex/order-items to be used inside VTEX IO apps. For documentation on the API, please refer to the provided package docs.

Usage

Use the function useOrderItems to get access to the API methods. Your component must be contained in a OrderItemsProvider, which in turn must be contained in a OrderFormProvider.

import { OrderFormProvider, useOrderForm } from 'vtex.order-manager/OrderForm'
import { OrderItemsProvider, useOrderItems } from 'vtex.order-items/OrderItems'

const MainComponent: FunctionComponent = () => (
  <OrderFormProvider>
    <OrderItemsProvider>
      <MyComponent />
    </OrderItemsProvider>
  </OrderFormProvider>
)

const MyComponent: FunctionComponent = () => {
  const { orderForm: { items } } = useOrderForm()
  const { updateQuantity, removeItem } = useOrderItems()
  // ...
}

Contributors (

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind are welcome!

Upcoming documentation: