Price Rule
Requires access scope.
A set of conditions, including entitlements and prerequisites, that must be met for a discount code to apply.
Use the types and queries included our discount tutorials instead. These will replace the GraphQL Admin API's object and union, and the REST Admin API's deprecated resource.
Anchor to FieldsFields
- Anchor to allocationLimitallocation•Int
Limit The maximum number of times that the price rule can be allocated onto an order.
- Anchor to allocationMethodallocation•Price
Method Rule Allocation Method! non-null The method by which the price rule's value is allocated to its entitled items.
- •App
The application that created the price rule.
- Anchor to combinesWithcombines•Discount
With Combines With! non-null The discount classes that you can use in combination with Shopify discount types.
- Anchor to createdAtcreated•Date
At Time! non-null The date and time when the price rule was created.
- Anchor to customerSelectioncustomer•Price
Selection Rule Customer Selection! non-null The customers that can use this price rule.
- Anchor to discountClassesdiscount•[Discount
Classes Class!]! non-null The classes of the discount.
- Anchor to discountCodesdiscount•Price
Codes Rule Discount Code Connection! non-null List of the price rule's discount codes.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
- Anchor to sortKeysort•Discount
Key Code Sort Keys Default:ID Sort the underlying list using a key. If your query is slow or returns an error, then try specifying a sort key that matches the field used in the search.
- Anchor to queryquery•String
A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
- Anchor to savedSearchIdsaved•ID
Search Id The ID of a saved search. The search’s query string is used as the query argument.
Arguments
- Anchor to discountCodesCountdiscount•Count
Codes Count How many discount codes associated with the price rule.
- Anchor to endsAtends•Date
At Time The date and time when the price rule ends. For open-ended price rules, use
null.- Anchor to eventsevents•Event
Connection! non-null The paginated list of events associated with the price rule.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
- Anchor to sortKeysort•Event
Key Sort Keys Default:ID Sort the underlying list using a key. If your query is slow or returns an error, then try specifying a sort key that matches the field used in the search.
- Anchor to queryquery•String
A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
- Anchor to comments•boolean
Whether or not to include comment-events in your search, passing
falsewill exclude comment-events, any other value will include comment-events.falsetrue- Anchor to created_at•time
Filter by the date and time when the event happened.
created_at:>2020-10-21created_at:<now- Anchor to subject_type•string
The resource type affected by this event. See EventSubjectType for possible values.
PRODUCT_VARIANTPRODUCTCOLLECTION
Example:
Example:
Example:
Arguments
- Anchor to featuresfeatures•[Price
Rule Feature!]! non-null A list of the price rule's features.
- Anchor to hasTimelineCommenthas•Boolean!
Timeline Comment non-null Indicates whether there are any timeline comments on the price rule.
- •ID!non-null
A globally-unique ID.
- Anchor to itemEntitlementsitem•Price
Entitlements Rule Item Entitlements! non-null The items to which the price rule applies.
- Anchor to itemPrerequisitesitem•Price
Prerequisites Rule Line Item Prerequisites! non-null The items required for the price rule to be applicable.
- Anchor to legacyResourceIdlegacy•Unsigned
Resource Id Int64! non-null The ID of the corresponding resource in the REST Admin API.
- Anchor to oncePerCustomeronce•Boolean!
Per Customer non-null Whether the price rule can be applied only once per customer.
- Anchor to prerequisiteQuantityRangeprerequisite•Price
Quantity Range Rule Quantity Range The number of the entitled items must fall within this range for the price rule to be applicable.
- Anchor to prerequisiteShippingPriceRangeprerequisite•Price
Shipping Price Range Rule Money Range The shipping cost must fall within this range for the price rule to be applicable.
- Anchor to prerequisiteSubtotalRangeprerequisite•Price
Subtotal Range Rule Money Range The sum of the entitled items subtotal prices must fall within this range for the price rule to be applicable.
- Anchor to prerequisiteToEntitlementQuantityRatioprerequisite•Price
To Entitlement Quantity Ratio Rule Prerequisite To Entitlement Quantity Ratio Quantity of prerequisite items required for the price rule to be applicable, compared to quantity of entitled items.
- •[Price
Rule Shareable Url!]! non-null URLs that can be used to share the discount.
- Anchor to shippingEntitlementsshipping•Price
Entitlements Rule Shipping Line Entitlements! non-null The shipping lines to which the price rule applies.
- Anchor to startsAtstarts•Date
At Time! non-null The date and time when the price rule starts.
- Anchor to statusstatus•Price
Rule Status! non-null The status of the price rule.
- Anchor to summarysummary•String
A detailed summary of the price rule.
- Anchor to targettarget•Price
Rule Target! non-null The type of lines (line_item or shipping_line) to which the price rule applies.
- Anchor to titletitle•String!non-null
The title of the price rule.
- Anchor to totalSalestotal•Money
Sales V2 The total sales from orders where the price rule was used.
- Anchor to usageCountusage•Int!
Count non-null The number of times that the price rule has been used. This value is updated asynchronously and can be different than the actual usage count.
- Anchor to usageLimitusage•Int
Limit The maximum number of times that the price rule can be used in total.
- Anchor to validityPeriodvalidity•Price
Period Rule Validity Period! non-null A time period during which a price rule is applicable.
- Anchor to valueV2value•Pricing
V2 Value! non-null The value of the price rule.
Deprecated fields
- Anchor to discountClassdiscount•Discount
Class Class! non-nullDeprecated - Anchor to entitlementToPrerequisiteQuantityRatioentitlement•Price
To Prerequisite Quantity Ratio Rule Entitlement To Prerequisite Quantity Ratio Deprecated - Anchor to traitstraits•[Price
Rule Trait!]! non-nullDeprecated - Anchor to valuevalue•Price
Rule Value! non-nullDeprecated