Skip to Content

ProductDiscount

Describes a product discount.

Type Definition

type ProductDiscount { amount: Float isPercentage: Boolean begins: String ends: String }

Fields

FieldTypeNullableDescriptionRelationships
amountFloatYesReturns the discount amount.None
isPercentageBooleanYesReturns true if discount is a percentage.None
beginsStringYesReturns the start date if it is set.None
endsStringYesReturns the end date if it is set.None

Relationships

  • The ProductDiscount object is used by the discountInformation field on the ProductVariant type.
  • This type does not have direct relationships to other object types but is typically accessed through ProductVariant.

Usage Examples

Basic Query

{ productVariant(id: 12345) { discountInformation { amount isPercentage begins ends } } }

Field Selection

{ productVariant(id: 12345) { discountInformation { amount isPercentage } } }

Nested Queries

{ productVariant(id: 12345) { id title discountInformation { amount begins ends } } }

Filtering and Sorting

The ProductDiscount type itself does not support filtering or sorting directly. Filtering and sorting should be applied on the parent object types such as ProductVariant or Product.

Example: Filtering product variants that have a discount starting after a specific date.

{ productVariants(filter: { discountInformation: { begins_gt: "2024-01-01T00:00:00Z" } }, sort: { field: "discountInformation.begins", direction: ASC }) { edges { node { id title discountInformation { amount begins } } } } }

Note: Actual filtering and sorting capabilities depend on the API implementation and may vary.

Implements

The ProductDiscount type does not implement any interfaces.

Connections

ProductDiscount is not a connection type and does not provide pagination or edges. It is a simple object type used as a field within other types.

  • ProductVariant — The type that contains the discountInformation field returning ProductDiscount.

Best Practices

  • Always check for nullability on all fields since all fields on ProductDiscount are optional.
  • Use the isPercentage field to determine how to interpret the amount field (as a fixed amount or a percentage).
  • When querying discounts, consider the begins and ends fields to understand the validity period of the discount.
  • To optimize performance, select only the fields you need from ProductDiscount to reduce payload size.

Notes

  • Dates in begins and ends are returned as ISO 8601 formatted strings.
  • The API currently requires no authentication but this may change in future versions.
  • ProductDiscount fields are read-only and represent computed or stored discount data.
  • Since all fields are optional, absence of values typically means no discount or unspecified discount period.
  • Use proper error handling in your client to handle cases where discount information might be missing.
Last updated on