Skip to main content

useCartActions

Overview

This hook will help you to add multiple items to the cart.

Props

NameTypeDescription
manageCartFunctionFunction to manage cart
cartActionLoadingBooleanLoading state of the cart action

Usage


import { useCartActions } from '@appmaker-xyz/shopify';

export default function ProductBundleDetail() {
const { manageCart, cartActionLoading } = useCartActions({});
const lineItemsToAdd = []; // Array of line items to add to cart

const addToCart = () => {
manageCart({
lineItemsToAdd,
});
};

return (
<Button
onPress={addToCart}
loading={cartActionLoading}
>
Add to cart
</Button>
);
}