Skip to main content

CartLineQuantity
component

The <CartLineQuantity/> component renders a span (or another element / component that can be customized by the as prop) with the cart line's quantity.

It must be a descendent of a <CartLineProvider/> component, and uses the useCartLine() hook internally.

ComponentGeneric

An HTML tag or React Component to be rendered as the base element wrapper. The default is span.

Was this section helpful?

Example code

import {CartLineQuantity, CartLineProvider} from '@shopify/hydrogen-react';

export function Example({line}) {
return (
<CartLineProvider line={line}>
<CartLineQuantity />
</CartLineProvider>
);
}