Skip to Content

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

FieldTypeNullableDescriptionRelated Type
typeStringYesReturns the type, either product, bundle or gift_card.
modelStringYesReturns the merchant defined model number.
imageStringYesReturns the image URL.
categoryPathStringYesReturns the category path.
lineDiscountFloatYesReturns the applied line discount in customer’s currency.
priceFloatYesReturns the unit price in customer’s currency.
linePriceFloatYesReturns the line price in customer’s currency.
netPriceFloatYesReturns the net price in customer’s currency.
taxFloatYesReturns the line tax in customer’s currency.
quantityIntYesReturns the quantity.
titleStringYesReturns the title.
descriptionStringYesReturns the description.
attributesLabelStringYesReturns a label for the attributes selected for the product.
attributes[String]YesReturns the attributes selected for the product.
gtinStringYesReturns a GTIN number for the product.
manufacturerStringYesReturns the manufacturer.
unitStringYesReturns a unit for the product.
productUrlStringYesReturns the product URL.
bundleItems[CartLineItem]YesReturns the bundle content if the type is bundle.CartLineItem
giftCardCodeStringYesReturns the gift card code if the type is gift_card.
giftCardValueFloatYesReturns the gift card value in customer’s currency if the type is gift_card.
giftCardExpiryStringYesReturns the gift card expiry date if the type is gift_card.
productProductYesReturns the associated product if it’s available at the store.Product
rateFloatYesReturns the tax rate in decimals.
ratePercentageFloatYesReturns the tax rate as a percentage.
idIntYesThe unique identifier of the cart item.

Relationships

  • bundleItems: If the type is bundle, this field returns an array of CartLineItem 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 where CartLineItem 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 of CartLineItem objects representing bundled products.
  • product connects to the Product object type, providing detailed product data related to the cart line item.
  • 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 the bundleItems 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 and attributesLabel to display product options or customizations selected by the customer.
  • When working with gift cards (type = gift_card), use giftCardCode, giftCardValue, and giftCardExpiry 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%), while ratePercentage 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