Home > @infiniteobjects/shopify-data-manager > AdminTypes > PriceRule
Price rules are a set of conditions, including entitlements and prerequisites, that must be met in order for a discount code to apply.
We recommend using the types and queries detailed at [Getting started with discounts](https://shopify.dev/docs/apps/selling-strategies/discounts/getting-started) instead. These will replace the GraphQL PriceRule
object and REST Admin PriceRule
and DiscountCode
resources.
Signature:
export interface PriceRule extends CommentEventSubject, HasEvents, LegacyInteroperability, Node
Extends: CommentEventSubject, HasEvents, LegacyInteroperability, Node
Property | Modifiers | Type | Description |
---|---|---|---|
allocationLimit? | Maybe<Scalars[‘Int’][‘output’]> | (Optional) The maximum number of times that the price rule can be allocated onto an order. | |
allocationMethod | PriceRuleAllocationMethod | `${PriceRuleAllocationMethod}` | The method by which the price rule’s value is allocated to its entitled items. | |
app? | Maybe<App> | (Optional) The application that created the price rule. | |
combinesWith | DiscountCombinesWith | Determines which discount classes the discount can combine with. | |
createdAt | Scalars[‘DateTime’][‘output’] | The date and time when the price rule was created. | |
customerSelection | PriceRuleCustomerSelection | The customers that can use this price rule. | |
discountClass | DiscountClass | `${DiscountClass}` | The class of the discount for combining purposes. | |
discountCodes | PriceRuleDiscountCodeConnection | List of the price rule’s discount codes. | |
discountCodesCount | Scalars[‘Int’][‘output’] | How many discount codes associated with the price rule. | |
endsAt? | Maybe<Scalars[‘DateTime’][‘output’]> | (Optional) The date and time when the price rule ends. For open-ended price rules, use null . |
|
entitlementToPrerequisiteQuantityRatio? | Maybe<PriceRuleEntitlementToPrerequisiteQuantityRatio> | (Optional) Quantity of prerequisite items required for the price rule to be applicable, compared to quantity of entitled items. | |
events | EventConnection | The paginated list of events associated with the price rule. | |
features | Array<PriceRuleFeature | `${PriceRuleFeature}`> | A list of the price rule’s features. | |
hasTimelineComment | Scalars[‘Boolean’][‘output’] | Indicates whether there are any timeline comments on the price rule. | |
id | Scalars[‘ID’][‘output’] | A globally-unique ID. | |
itemEntitlements | PriceRuleItemEntitlements | The items to which the price rule applies. | |
itemPrerequisites | PriceRuleLineItemPrerequisites | The items required for the price rule to be applicable. | |
legacyResourceId | Scalars[‘UnsignedInt64’][‘output’] | The ID of the corresponding resource in the REST Admin API. | |
oncePerCustomer | Scalars[‘Boolean’][‘output’] | Whether the price rule can be applied only once per customer. | |
prerequisiteQuantityRange? | Maybe<PriceRuleQuantityRange> | (Optional) The number of the entitled items must fall within this range for the price rule to be applicable. | |
prerequisiteShippingPriceRange? | Maybe<PriceRuleMoneyRange> | (Optional) The shipping cost must fall within this range for the price rule to be applicable. | |
prerequisiteSubtotalRange? | Maybe<PriceRuleMoneyRange> | (Optional) The sum of the entitled items subtotal prices must fall within this range for the price rule to be applicable. | |
prerequisiteToEntitlementQuantityRatio? | Maybe<PriceRulePrerequisiteToEntitlementQuantityRatio> | (Optional) Quantity of prerequisite items required for the price rule to be applicable, compared to quantity of entitled items. | |
shareableUrls | Array<PriceRuleShareableUrl> | URLs that can be used to share the discount. | |
shippingEntitlements | PriceRuleShippingLineEntitlements | The shipping lines to which the price rule applies. | |
startsAt | Scalars[‘DateTime’][‘output’] | The date and time when the price rule starts. | |
status | PriceRuleStatus | `${PriceRuleStatus}` | The status of the price rule. | |
summary? | Maybe<Scalars[‘String’][‘output’]> | (Optional) A detailed summary of the price rule. | |
target | PriceRuleTarget | `${PriceRuleTarget}` | The type of lines (line_item or shipping_line) to which the price rule applies. | |
title | Scalars[‘String’][‘output’] | The title of the price rule. | |
totalSales? | Maybe<MoneyV2> | (Optional) The total sales from orders where the price rule was used. | |
traits | Array<PriceRuleTrait | `${PriceRuleTrait}`> | A list of the price rule’s features. | |
usageCount | Scalars[‘Int’][‘output’] | 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. | |
usageLimit? | Maybe<Scalars[‘Int’][‘output’]> | (Optional) The maximum number of times that the price rule can be used in total. | |
validityPeriod | PriceRuleValidityPeriod | A time period during which a price rule is applicable. | |
value | PriceRuleValue | The value of the price rule. | |
valueV2 | PricingValue | The value of the price rule. |