Skip to Content

CartDiscount

Describes a cart discount, including title, description, discount percentage, type, code, and total amount.

Type Definition

type CartDiscount { title: String description: String discountPercent: Float type: String code: String amount: Float totalAmount: Float totalSavings: Float }

Fields

FieldTypeNullableDescriptionRelated Types
titleStringYesReturns the title of the discount.None
descriptionStringYesReturns the description of the discount.None
discountPercentFloatYesReturns the discount percentage applied.None
typeStringYesReturns the discount type (e.g., coupon, automatic).None
codeStringYesReturns the discount code for coupons.None
amountFloatYesReturns the discount amount in the customer’s currency.None
totalAmountFloatYesReturns the total discount amount in the customer’s currency.None
totalSavingsFloatYesReturns the total savings in the customer’s currency.None

Relationships

The CartDiscount object type does not have explicit relationships to other object types defined in the source material. It primarily represents discount details applied to a cart and is typically nested within cart-related queries or mutations.

Usage Examples

Basic Query

query { cartDiscount { title description discountPercent type code amount totalAmount totalSavings } }

Field Selection

query { cartDiscount { title discountPercent code } }

Nested Queries

query { cart(id: 98765) { discounts { title description amount totalSavings } } }

Filtering and Sorting

The CartDiscount type itself does not support filtering or sorting fields directly. These operations should be performed at the parent level (e.g., filtering discounts within a cart or order) if supported by the API.

Implements

The CartDiscount type does not implement any interfaces as per the provided source.

Connections

No connection fields or pagination are defined for CartDiscount in the source material.

While not explicitly defined in the source, CartDiscount is commonly related to cart or order types where discounts are applied. For example, it may be nested inside a Cart object under a discounts field.

Best Practices

  • Always check for nullability on all fields since all fields in CartDiscount are optional.
  • Use the code field to identify coupon-based discounts uniquely.
  • Use discountPercent and amount fields together to understand the discount impact.
  • When querying multiple discounts on a cart, retrieve totalAmount and totalSavings to summarize the overall discount effect.
  • Avoid requesting all fields if only a subset is needed to reduce response size and improve performance.

Notes

  • All monetary fields (amount, totalAmount, totalSavings) are returned in the customer’s currency.
  • The API currently requires no authentication but this may change in future versions.
  • Since all fields are optional, clients should implement proper null checks to avoid runtime errors.
  • There are no computed or derived fields explicitly defined for CartDiscount.
  • No field arguments are defined for this type.
  • Performance considerations: Minimize requested fields to improve response times, especially when querying multiple discounts within large carts.
Last updated on