Skip to main content

useCurrentCart

This hook returns the current Shopify cart object from the app's persisted storage. Use it to access cart data outside of the cart page.

Import​

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

Basic Usage​

const cart = useCurrentCart();

Return Value​

PropertyTypeDescription
cartObject \| undefinedThe current Shopify cart object stored in app storage. Returns undefined if no cart exists.