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.
Params | Description |
---|---|
variantId | Variant id of the product |
productId | Product 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
});