PriceRule

Required access

read_price_rules access scope

Price rules are a set of conditions, including entitlements and prerequisites, that must be met in order for a discount code to apply.

Show definition
# Price rules are a set of conditions, including entitlements and prerequisites,
# that must be met in order for a discount code to apply.
type PriceRule implements Node, CommentEventSubject {
  # Globally unique identifier.
  id: ID!

  # Indicates whether or not any timeline comments have been made on the price rule.
  hasTimelineComment: Boolean!

  # The maximum number of times the price rule will be allocated onto an order.
  allocationLimit: Int

  # The method by which the price rule's value is allocated to its entitled items.
  allocationMethod: PriceRuleAllocationMethod!

  # The application that created the price rule.
  app: App

  # When the price rule was created.
  createdAt: DateTime!

  # A selection of customers for whom the price rule applies.
  customerSelection: PriceRuleCustomerSelection!

  # List of the price rule's discount codes.
  discountCodes(
    # Returns up to the first `n` elements from the list.
    first: Int

    # Returns the elements that come after the specified cursor.
    after: String

    # Returns up to the last `n` elements from the list.
    last: Int

    # Returns the elements that come before the specified cursor.
    before: String

    # Reverse the order of the underlying list.
    reverse: Boolean = false

    # Sort the underlying list by the given key.
    sortKey: DiscountCodeSortKeys = ID

    # Supported filter parameters:
    #  - `times_used`
    query: String

    # ID of an existing saved search.
    # The search’s query string will be used as the query argument.
    savedSearchId: ID
  ): PriceRuleDiscountCodeConnection!

  # How many discount codes associated with the price rule.
  discountCodesCount: Int!

  # When the price rule expires, or never if null.
  endsAt: DateTime

  # Quantity of prerequisite items required for the price rule to be applicable,  compared to quantity of entitled items.
  entitlementToPrerequisiteQuantityRatio: PriceRuleEntitlementToPrerequisiteQuantityRatio

  # The paginated list of events associated with the price rule.
  events(
    # Returns up to the first `n` elements from the list.
    first: Int

    # Returns the elements that come after the specified cursor.
    after: String

    # Returns up to the last `n` elements from the list.
    last: Int

    # Returns the elements that come before the specified cursor.
    before: String

    # Reverse the order of the underlying list.
    reverse: Boolean = false

    # Sort the underlying list by the given key.
    sortKey: EventSortKeys = ID

    # Supported filter parameters:
    #  - `created_at`
    #  - `comments`
    query: String
  ): EventConnection!

  # A list of features used by the price rule.
  features: [PriceRuleFeature!]!

  # The items to which the price rule applies.
  itemEntitlements: PriceRuleItemEntitlements!

  # The line item objects required for the price rule to be applicable.
  itemPrerequisites: PriceRuleLineItemPrerequisites!

  # Whether the price rule can be applied only once per customer.
  oncePerCustomer: Boolean!

  # The number of the entitled items must fall within this range for the price rule to be applicable.
  prerequisiteQuantityRange: PriceRuleQuantityRange

  # The shipping cost must fall within this range for the price rule to be applicable.
  prerequisiteShippingPriceRange: PriceRuleMoneyRange

  # The sum of the entitled items subtotal prices must fall within this range for the price rule to be applicable.
  prerequisiteSubtotalRange: PriceRuleMoneyRange

  # Quantity of prerequisite items required for the price rule to be applicable,  compared to quantity of entitled items.
  prerequisiteToEntitlementQuantityRatio: PriceRulePrerequisiteToEntitlementQuantityRatio

  # The url used to share the discount.
  shareableUrl: URL

  # URLs that can be used to share the discount.
  shareableUrls: [PriceRuleShareableUrl!]!

  # The shipping lines to which the price rule applies.
  shippingEntitlements: PriceRuleShippingLineEntitlements!

  # When the price rule is starting to be active.
  startsAt: DateTime!

  # The status of the price rule.
  status: PriceRuleStatus!

  # A summary of the price rule.
  summary: String

  # The type of lines (line_item or shipping_line) to which the price rule applies.
  target: PriceRuleTarget!

  # The title of the price rule.
  title: String!

  # The total sales brought by the price rule.
  totalSales: MoneyV2

  # A list of features used by the price rule.
  traits: [PriceRuleTrait!]!

  # How many times the price rule has been used.
  usageCount: Int!

  # The maximum number of times the price rule can be applied.
  usageLimit: Int

  # A time period during which a price rule is applicable.
  validityPeriod: PriceRuleValidityPeriod!

  # The value of the price rule.
  value: PriceRuleValue!

  # The value of the price rule.
  valueV2: PricingValue!
}

Implements

Connections

discountCodes   (PriceRuleDiscountCodeConnection!)

List of the price rule's discount codes.

Required access

read_ access scope

Argument Type Default Description
after

String

Returns the elements that come after the specified cursor.

before

String

Returns the elements that come before the specified cursor.

first

Int

Returns up to the first n elements from the list.

last

Int

Returns up to the last n elements from the list.

query

String

Supported filter parameters:

  • times_used

reverse

Boolean

false

Reverse the order of the underlying list.

savedSearchId

ID

ID of an existing saved search. The search’s query string will be used as the query argument.

sortKey

DiscountCodeSortKeys

ID

Sort the underlying list by the given key.

events   (EventConnection!)

The paginated list of events associated with the price rule.

Required access

read_ access scope

Argument Type Default Description
after

String

Returns the elements that come after the specified cursor.

before

String

Returns the elements that come before the specified cursor.

first

Int

Returns up to the first n elements from the list.

last

Int

Returns up to the last n elements from the list.

query

String

Supported filter parameters:

  • created_at
  • comments

reverse

Boolean

false

Reverse the order of the underlying list.

sortKey

EventSortKeys

ID

Sort the underlying list by the given key.

Fields

allocationLimit   (Int)

The maximum number of times the price rule will be allocated onto an order.

Required access

read_ access scope

allocationMethod   (PriceRuleAllocationMethod!)

The method by which the price rule's value is allocated to its entitled items.

Required access

read_ access scope

app   (App)

The application that created the price rule.

Required access

read_ access scope

createdAt   (DateTime!)

When the price rule was created.

Required access

read_ access scope

customerSelection   (PriceRuleCustomerSelection!)

A selection of customers for whom the price rule applies.

Required access

read_ access scope

discountCodesCount   (Int!)

How many discount codes associated with the price rule.

Required access

read_ access scope

endsAt   (DateTime)

When the price rule expires, or never if null.

Required access

read_ access scope

features   ([PriceRuleFeature!]!)

A list of features used by the price rule.

Required access

read_ access scope

hasTimelineComment   (Boolean!)

Indicates whether or not any timeline comments have been made on the price rule.

Required access

read_ access scope

id   (ID!)

Globally unique identifier.

Required access

read_ access scope

itemEntitlements   (PriceRuleItemEntitlements!)

The items to which the price rule applies.

Required access

read_ access scope

itemPrerequisites   (PriceRuleLineItemPrerequisites!)

The line item objects required for the price rule to be applicable.

Required access

read_ access scope

oncePerCustomer   (Boolean!)

Whether the price rule can be applied only once per customer.

Required access

read_ access scope

prerequisiteQuantityRange   (PriceRuleQuantityRange)

The number of the entitled items must fall within this range for the price rule to be applicable.

Required access

read_ access scope

prerequisiteShippingPriceRange   (PriceRuleMoneyRange)

The shipping cost must fall within this range for the price rule to be applicable.

Required access

read_ access scope

prerequisiteSubtotalRange   (PriceRuleMoneyRange)

The sum of the entitled items subtotal prices must fall within this range for the price rule to be applicable.

Required access

read_ access scope

prerequisiteToEntitlementQuantityRatio   (PriceRulePrerequisiteToEntitlementQuantityRatio)

Quantity of prerequisite items required for the price rule to be applicable, compared to quantity of entitled items.

Required access

read_ access scope

shareableUrls   ([PriceRuleShareableUrl!]!)

URLs that can be used to share the discount.

Required access

read_ access scope

shippingEntitlements   (PriceRuleShippingLineEntitlements!)

The shipping lines to which the price rule applies.

Required access

read_ access scope

startsAt   (DateTime!)

When the price rule is starting to be active.

Required access

read_ access scope

status   (PriceRuleStatus!)

The status of the price rule.

Required access

read_ access scope

summary   (String)

A summary of the price rule.

Required access

read_ access scope

target   (PriceRuleTarget!)

The type of lines (line_item or shipping_line) to which the price rule applies.

Required access

read_ access scope

title   (String!)

The title of the price rule.

Required access

read_ access scope

totalSales   (MoneyV2)

The total sales brought by the price rule.

Required access

read_ access scope

usageCount   (Int!)

How many times the price rule has been used.

Required access

read_ access scope

usageLimit   (Int)

The maximum number of times the price rule can be applied.

Required access

read_ access scope

validityPeriod   (PriceRuleValidityPeriod!)

A time period during which a price rule is applicable.

Required access

read_ access scope

valueV2   (PricingValue!)

The value of the price rule.

Required access

read_ access scope

Deprecated fields

Show/Hide

entitlementToPrerequisiteQuantityRatio   (PriceRuleEntitlementToPrerequisiteQuantityRatio)

deprecated

Quantity of prerequisite items required for the price rule to be applicable, compared to quantity of entitled items.

Deprecation warning

Use prerequisiteToEntitlementQuantityRatio instead

Required access

read_ access scope

shareableUrl   (URL)

deprecated

The url used to share the discount.

Deprecation warning

Use shareableUrls instead

Required access

read_ access scope

traits   ([PriceRuleTrait!]!)

deprecated

A list of features used by the price rule.

Deprecation warning

Use features instead

Required access

read_ access scope

value   (PriceRuleValue!)

deprecated

The value of the price rule.

Deprecation warning

Use valueV2 instead

Required access

read_ access scope

Sign up for a Partner account to get started.

Sign up