Skip to main content

API

The @hv/cart package contains an /api folder that exports code to stand-up Next.js Route Handlers.

These endpoints each correspond to a React hook from the @hv/cart/client export, and use the Cart integration function as the underlying implementation.

Together these are useful for fetching and mutating data in client components.

EndpointHook
removeFromCartuseRemoveFromCart
removePromoCodeuseRemovePromoCode
updateLineItemuseUpdateLineItem
placeOrderusePlaceOrder
getProductuseProduct
getPaymentMethodsusePaymentMethods
addPromoCodeuseAddPromoCode
updateCartuseUpdateCart
getCartuseCart
getOrderuseOrder
addToCartuseAddToCart