Skip to Content

ProductPromotion

Describes a product promotion, providing details such as the promotion type, title, and description.

Type Definition

type ProductPromotion { type: String title: String description: String }

Fields

FieldTypeNullableDescriptionRelationship
typeStringYesReturns the promotion type.None
titleStringYesReturns the promotion title if any.None
descriptionStringYesReturns the promotion description if any.None

Relationships

  • The ProductPromotion type is used by the ProductVariant object through its promotion field. This indicates that each product variant can have an associated promotion described by this type.

Usage Examples

Basic Query

{ productVariant(id: 12345) { promotion { type title description } } }

Field Selection

{ productVariant(id: 12345) { promotion { title description } } }

Nested Queries

{ productVariant(id: 12345) { id sku promotion { type title } } }

Filtering and Sorting

The ProductPromotion object itself does not support filtering or sorting directly. Filtering and sorting should be applied on the parent objects such as ProductVariant when querying promotions.

Example: Filtering product variants that have a promotion with a specific type.

{ productVariants(filter: { promotionType: "Discount" }, sort: { field: "sku", direction: ASC }) { edges { node { id sku promotion { type title } } } } }

Note: The above filtering example assumes the API supports filtering on promotionType at the ProductVariant level.

Implements

The ProductPromotion type does not implement any interfaces.

Connections

There are no direct connection fields on ProductPromotion. It is embedded within ProductVariant.

  • ProductVariant: The parent object that contains the promotion field of type ProductPromotion.

Best Practices

  • Always check for nullability on all fields (type, title, description) as they are optional and may not be present in every promotion.
  • Use field selection to request only the promotion details you need to optimize query performance.
  • When querying promotions, consider filtering and sorting at the ProductVariant level to efficiently retrieve relevant promotions.
  • Avoid requesting unnecessary nested data to reduce response size and improve API responsiveness.

Notes

  • The ProductPromotion object contains only scalar fields and no computed or derived fields.
  • There are no field arguments on ProductPromotion.
  • Since ProductPromotion is a nested object within ProductVariant, accessing it requires querying the parent ProductVariant.
  • The API currently requires no authentication; however, this may change in future versions.
  • Consider caching promotion data on the client side if promotions do not change frequently to reduce API calls.
  • Handle cases where promotion fields may be null gracefully in your application to avoid runtime errors.
Last updated on