Skip to main content

useProductCartQuantity

The useProductCartQuantity hook is used to get the product cart quantity data.

If you want to get the cart quantity of a product on the product detail page, you can use this hook. You can also get the cart line item data of the product.

ParamsDescription
variantIdVariant id of the product
productIdProduct id of the product

Usage


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

const [cartQuantity, cartLineItem] = useProductCartQuantity({
variantId: productVariant?.node?.id, // Variant id of the product
});


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

const [cartQuantity, cartLineItem] = useProductCartQuantity({
productId, // Product id of the product
});