CartLineItem
Describes a cart line item, including product details, pricing, and attributes.
Type Definition
type CartLineItem {
type: String
model: String
image: String
categoryPath: String
lineDiscount: Float
price: Float
linePrice: Float
netPrice: Float
tax: Float
quantity: Int
title: String
description: String
attributesLabel: String
attributes: [String]
gtin: String
manufacturer: String
unit: String
productUrl: String
bundleItems: [CartLineItem]
giftCardCode: String
giftCardValue: Float
giftCardExpiry: String
product: Product
rate: Float
ratePercentage: Float
id: Int
}
Fields
Field | Type | Nullable | Description | Related Type |
---|---|---|---|---|
type | String | Yes | Returns the type, either product , bundle or gift_card . | — |
model | String | Yes | Returns the merchant defined model number. | — |
image | String | Yes | Returns the image URL. | — |
categoryPath | String | Yes | Returns the category path. | — |
lineDiscount | Float | Yes | Returns the applied line discount in customer’s currency. | — |
price | Float | Yes | Returns the unit price in customer’s currency. | — |
linePrice | Float | Yes | Returns the line price in customer’s currency. | — |
netPrice | Float | Yes | Returns the net price in customer’s currency. | — |
tax | Float | Yes | Returns the line tax in customer’s currency. | — |
quantity | Int | Yes | Returns the quantity. | — |
title | String | Yes | Returns the title. | — |
description | String | Yes | Returns the description. | — |
attributesLabel | String | Yes | Returns a label for the attributes selected for the product. | — |
attributes | [String] | Yes | Returns the attributes selected for the product. | — |
gtin | String | Yes | Returns a GTIN number for the product. | — |
manufacturer | String | Yes | Returns the manufacturer. | — |
unit | String | Yes | Returns a unit for the product. | — |
productUrl | String | Yes | Returns the product URL. | — |
bundleItems | [CartLineItem] | Yes | Returns the bundle content if the type is bundle . | CartLineItem |
giftCardCode | String | Yes | Returns the gift card code if the type is gift_card . | — |
giftCardValue | Float | Yes | Returns the gift card value in customer’s currency if the type is gift_card . | — |
giftCardExpiry | String | Yes | Returns the gift card expiry date if the type is gift_card . | — |
product | Product | Yes | Returns the associated product if it’s available at the store. | Product |
rate | Float | Yes | Returns the tax rate in decimals. | — |
ratePercentage | Float | Yes | Returns the tax rate as a percentage. | — |
id | Int | Yes | The unique identifier of the cart item. | — |
Relationships
- bundleItems: If the
type
isbundle
, this field returns an array ofCartLineItem
objects representing the contents of the bundle. This allows nested access to individual items within a bundle. - product: Links to the
Product
object associated with the cart line item, if available in the store. This relationship enables retrieval of detailed product information related to the cart item.
Usage Examples
Basic Query
{
cartLineItem(id: 12345) {
id
type
title
quantity
price
linePrice
}
}
Field Selection
{
cartLineItem(id: 12345) {
id
type
model
image
categoryPath
lineDiscount
netPrice
tax
rate
ratePercentage
description
attributesLabel
attributes
gtin
manufacturer
unit
productUrl
}
}
Nested Queries
{
cartLineItem(id: 12345) {
id
type
title
quantity
bundleItems {
id
title
quantity
price
}
product {
id
title
description
manufacturer
}
}
}
Filtering and Sorting
Note: The
CartLineItem
type itself does not define filtering or sorting arguments. Filtering and sorting are typically applied at the query or connection level whereCartLineItem
objects are returned in lists.
Example of retrieving cart line items sorted by price
descending and filtered by type
:
{
cartLineItems(filter: { type: "product" }, sort: { field: PRICE, direction: DESC }) {
edges {
node {
id
title
price
quantity
}
}
}
}
(Note: The above query assumes the existence of a cartLineItems
connection with filtering and sorting capabilities in the API.)
Implements
This type does not explicitly implement any GraphQL interfaces.
Connections
bundleItems
is a self-referential connection returning a list ofCartLineItem
objects representing bundled products.product
connects to theProduct
object type, providing detailed product data related to the cart line item.
Related Types
- Product: Represents detailed product information associated with the cart line item.
- CartLineItem: Supports nested line items for bundles.
- String: Used for various descriptive and identifier fields.
- Float: Used for pricing, tax, and discount fields.
- Int: Used for identifiers and quantity.
Best Practices
- Use the
id
field to uniquely identify cart line items when performing updates or queries. - When dealing with bundles (
type
=bundle
), access thebundleItems
field to retrieve individual items within the bundle. - Use the
product
field to fetch detailed product information only when necessary to reduce query complexity and improve performance. - Select only the fields you need to optimize query performance and reduce response size.
- For pricing fields (
price
,linePrice
,netPrice
,lineDiscount
,tax
), ensure your client handles currency formatting appropriately. - Use
attributes
andattributesLabel
to display product options or customizations selected by the customer. - When working with gift cards (
type
=gift_card
), usegiftCardCode
,giftCardValue
, andgiftCardExpiry
to manage gift card details.
Notes
- All fields are optional and may return
null
if the data is unavailable. - The
rate
field returns the tax rate as a decimal (e.g., 0.07 for 7%), whileratePercentage
returns it as a percentage (e.g., 7.0). - The API currently requires no authentication, but this may change in future versions. Plan accordingly for potential authentication requirements.
- Nested
bundleItems
queries can increase response size and complexity; use them judiciously. - Caching responses that include pricing and tax fields should consider that these values may change due to promotions or tax rate updates.
- No computed or derived fields beyond those explicitly defined are present in this type.
- No field arguments are defined on any fields of this type. Filtering, sorting, and pagination are expected to be handled at the query or connection level, not within
CartLineItem
fields.
Endpoint URL for queries:
https://www.mystoreurl.com/graphql/0.8.0/
Last updated on