useCartActions
Overview
This hook will help you to add multiple items to the cart.
Props
Name | Type | Description |
---|---|---|
manageCart | Function | Function to manage cart |
cartActionLoading | Boolean | Loading 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>
);
}