PriceRule
You can use the PriceRule resource to create discounts using conditions. You can then associate the conditions with a discount code by using the DiscountCode resource. Merchants can distribute the discount codes to their customers.
Using the PriceRule resource, you can create discounts that specify a discount as a percentage, a fixed amount, or free shipping. You use entitlements and prerequisites to dynamically build these discounts.
To learn about how to associate a price rule with a discount code, see the DiscountCode resource.
Create a price rule
You can create price rules with entitlements and prerequisites. Entitlements describe the designated resources that a discount applies to, such as specific products, variants, or collections. Prerequisites describe the requirements that must be met in order for the discount to apply to the entitled resources. For example, you might want a discount to apply only to a certain shipping price range, or a certain subtotal range.
You can use entitlements, prereqisites, and other conditions to create discounts, such as the following examples:
- $10 off the buyer's order if the total exceeds $40
- 15% off certain collections
- free shipping on orders over $100.00 for Canadian buyers, redeemable up to 20 times
For examples of how to create price rules, see the POST method.
What you can do with PriceRule
The Shopify API lets you do the following with the PriceRule resource. More detailed versions of these general actions may be available:
- POST /admin/api/2020-01/price_rules.json Creates a price rule
- PUT /admin/api/2020-01/price_rules/{price_rule_id}.json Updates an existing a price rule
- GET /admin/api/2020-01/price_rules.json Retrieves a list of price rules
- GET /admin/api/2020-01/price_rules/{price_rule_id}.json Retrieves a single price rule
- GET /admin/api/2020-01/price_rules/count.json Retrieves a count of all price rules
- DELETE /admin/api/2020-01/price_rules/{price_rule_id}.json Remove an existing PriceRule
PriceRule properties
allocation_method |
The allocation method of the price rule. Valid values:
When the value of |
created_at
read-only |
The date and time (ISO 8601 format) when the price rule was created. |
updated_at
read-only |
The date and time (ISO 8601 format) when the price rule was updated. |
customer_selection |
The customer selection for the price rule. Valid values:
|
ends_at |
The date and time (ISO 8601 format) when the price rule ends. Must be after |
entitled_collection_ids |
A list of IDs of collections whose products will be eligible to the discount. It can be used only with
|
entitled_country_ids |
A list of IDs of shipping countries that will be entitled to the discount. It can be used only with |
entitled_product_ids |
A list of IDs of products that will be entitled to the discount. It can be used only with If a product variant is included in |
entitled_variant_ids |
A list of IDs of product variants that will be entitled to the discount. It can be used only with If a product is included in |
id
read-only |
The ID for the price rule. |
once_per_customer |
Whether the generated discount code will be valid only for a single use per customer. This is tracked using customer ID. |
prerequisite_customer_ids |
A list of customer IDs. For the price rule to be applicable, the customer must match one of the specified customers. If |
prerequisite_quantity_range |
The minimum number of items for the price rule to be applicable. It has the following property:
|
prerequisite_saved_search_ids |
A list of customer saved search IDs. For the price rule to be applicable, the customer must be in the group of customers matching a customer saved search. If |
prerequisite_shipping_price_range |
The maximum shipping price for the price rule to be applicable. It has the following property:
|
prerequisite_subtotal_range |
The minimum subtotal for the price rule to be applicable. It has the following property:
|
starts_at |
The date and time (ISO 8601 format) when the price rule starts. |
target_selection |
The target selection method of the price rule. Valid values:
|
target_type |
The target type that the price rule applies to. Valid values:
|
title |
The title of the price rule. This is used by the Shopify admin search to retrieve discounts. It is also displayed on the Discounts page of the Shopify admin for bulk discounts. For non-bulk discounts, the discount code is displayed on the admin. For a consistent search experience, use the same value for |
usage_limit |
The maximum number of times the price rule can be used, per discount code. |
prerequisite_product_ids |
List of product ids that will be a prerequisites for a Buy X Get Y type discount. The
CautionIf a product variant is included in |
prerequisite_variant_ids |
List of variant ids that will be a prerequisites for a Buy X Get Y type discount. The
CautionIf a product is included in |
prerequisite_collection_ids |
List of collection ids that will be a prerequisites for a Buy X Get Y discount. The
prerequisite_product_ids or prerequisite_variant_ids .
|
value |
The value of the price rule. If if the value of |
value_type |
The value type of the price rule. Valid values:
If |
prerequisite_to_entitlement_quantity_ratio |
Buy/Get ratio for a Buy X Get Y discount. The
CautionCannot be used in combination with |
allocation_limit |
The number of times the discount can be allocated on the cart - if eligible. For example a Buy 1 hat Get 1 hat for free discount can be applied 3 times on a cart having more than 6 hats, where maximum of 3 hats get discounted - if the Caution
|
Endpoints
Create a price rule that gives the buyer $10.00 off an order
POST /admin/api/2020-01/price_rules.json
{
"price_rule": {
"title": "SUMMERSALE10OFF",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341478,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:04-05:00",
"updated_at": "2021-01-01T14:39:04-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "SUMMERSALE10OFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341478"
}
}
Create a price rule that gives the buyer 15% off a specific collection
POST /admin/api/2020-01/price_rules.json
{
"price_rule": {
"title": "15OFFCOLLECTION",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "across",
"value_type": "percentage",
"value": "-15.0",
"customer_selection": "all",
"entitled_collection_ids": [
841564295
],
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341479,
"value_type": "percentage",
"value": "-15.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:05-05:00",
"updated_at": "2021-01-01T14:39:05-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [
841564295
],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "15OFFCOLLECTION",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341479"
}
}
Create a price rule that gives the buyer free shipping on orders over $50.00 that can be used up to 20 times
POST /admin/api/2020-01/price_rules.json
{
"price_rule": {
"title": "FREESHIPPING",
"target_type": "shipping_line",
"target_selection": "all",
"allocation_method": "each",
"value_type": "percentage",
"value": "-100.0",
"usage_limit": 20,
"customer_selection": "all",
"prerequisite_subtotal_range": {
"greater_than_or_equal_to": "50.0"
},
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341480,
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "shipping_line",
"target_selection": "all",
"allocation_method": "each",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": 20,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:06-05:00",
"updated_at": "2021-01-01T14:39:06-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": {
"greater_than_or_equal_to": "50.0"
},
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "FREESHIPPING",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341480"
}
}
Create a price rule that gives a select group of customers $5 off their order
POST /admin/api/2020-01/price_rules.json
{
"price_rule": {
"title": "5OFFCUSTOMERGROUP",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"value_type": "fixed_amount",
"value": "-5.0",
"customer_selection": "prerequisite",
"prerequisite_saved_search_ids": [
789629109
],
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341481,
"value_type": "fixed_amount",
"value": "-5.0",
"customer_selection": "prerequisite",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:07-05:00",
"updated_at": "2021-01-01T14:39:07-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [
789629109
],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "5OFFCUSTOMERGROUP",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341481"
}
}
Create a Buy X Get Y price rule that gives one free ipod touch if customer buys 2 ipods
POST /admin/api/2020-01/price_rules.json
{
"price_rule": {
"title": "Buy2iPodsGetiPodTouchForFree",
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "each",
"starts_at": "2018-03-22T00:00:00-00:00",
"prerequisite_collection_ids": [
841564295
],
"entitled_product_ids": [
921728736
],
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": 2,
"entitled_quantity": 1
},
"allocation_limit": 3
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341482,
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "each",
"allocation_limit": 3,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2018-03-21T20:00:00-04:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:08-05:00",
"updated_at": "2021-01-01T14:39:08-05:00",
"entitled_product_ids": [
921728736
],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [
841564295
],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": 2,
"entitled_quantity": 1
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "Buy2iPodsGetiPodTouchForFree",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341482"
}
}
Update the title of a price rule
PUT /admin/api/2020-01/price_rules/507328175.json
{
"price_rule": {
"id": 507328175,
"title": "WINTER SALE"
}
}
View Response
HTTP/1.1 200 OK
{
"price_rule": {
"id": 507328175,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-26T14:22:39-05:00",
"ends_at": "2021-01-07T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:38:59-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "WINTER SALE",
"admin_graphql_api_id": "gid://shopify/PriceRule/507328175"
}
}
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The maximum number of results to retrieve. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show price rules created after date (format 2017-03-25T16:15:47-04:00). |
created_at_max
|
Show price rules created before date (format 2017-03-25T16:15:47-04:00). |
updated_at_min
|
Show price rules last updated after date (format 2017-03-25T16:15:47-04:00). |
updated_at_max
|
Show price rules last updated before date (format 2017-03-25T16:15:47-04:00). |
starts_at_min
|
Show price rules starting after date (format 2017-03-25T16:15:47-04:00). |
starts_at_max
|
Show price rules starting before date (format 2017-03-25T16:15:47-04:00). |
ends_at_min
|
Show price rules ending after date (format 2017-03-25T16:15:47-04:00). |
ends_at_max
|
Show price rules ending before date (format 2017-03-25T16:15:47-04:00). |
times_used
|
Show price rules with times used. |
Retrieve all price rules
GET /admin/api/2020-01/price_rules.json
View Response
HTTP/1.1 200 OK
{
"price_rules": [
{
"id": 507328175,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-26T14:22:39-05:00",
"ends_at": "2021-01-07T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:22:39-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"title": "SUMMERSALE10OFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/507328175"
},
{
"id": 106886544,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-30T14:22:39-05:00",
"ends_at": "2021-01-03T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:22:39-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"title": "TENOFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/106886544"
}
]
}
Retrieve a single price rule by its ID
GET /admin/api/2020-01/price_rules/507328175.json
View Response
HTTP/1.1 200 OK
{
"price_rule": {
"id": 507328175,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-26T14:22:39-05:00",
"ends_at": "2021-01-07T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:22:39-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "SUMMERSALE10OFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/507328175"
}
}
Retrieve a count of all price rules
GET /admin/api/2020-01/price_rules/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
Delete a price rule
DELETE /admin/api/2020-01/price_rules/507328175.json
View Response
HTTP/1.1 204 No Content
You can use the PriceRule resource to create discounts using conditions. You can then associate the conditions with a discount code by using the DiscountCode resource. Merchants can distribute the discount codes to their customers.
Using the PriceRule resource, you can create discounts that specify a discount as a percentage, a fixed amount, or free shipping. You use entitlements and prerequisites to dynamically build these discounts.
To learn about how to associate a price rule with a discount code, see the DiscountCode resource.
Create a price rule
You can create price rules with entitlements and prerequisites. Entitlements describe the designated resources that a discount applies to, such as specific products, variants, or collections. Prerequisites describe the requirements that must be met in order for the discount to apply to the entitled resources. For example, you might want a discount to apply only to a certain shipping price range, or a certain subtotal range.
You can use entitlements, prereqisites, and other conditions to create discounts, such as the following examples:
- $10 off the buyer's order if the total exceeds $40
- 15% off certain collections
- free shipping on orders over $100.00 for Canadian buyers, redeemable up to 20 times
For examples of how to create price rules, see the POST method.
What you can do with PriceRule
The Shopify API lets you do the following with the PriceRule resource. More detailed versions of these general actions may be available:
- POST /admin/api/2020-04/price_rules.json Creates a price rule
- PUT /admin/api/2020-04/price_rules/{price_rule_id}.json Updates an existing a price rule
- GET /admin/api/2020-04/price_rules.json Retrieves a list of price rules
- GET /admin/api/2020-04/price_rules/{price_rule_id}.json Retrieves a single price rule
- GET /admin/api/2020-04/price_rules/count.json Retrieves a count of all price rules
- DELETE /admin/api/2020-04/price_rules/{price_rule_id}.json Remove an existing PriceRule
PriceRule properties
allocation_method |
The allocation method of the price rule. Valid values:
When the value of |
created_at
read-only |
The date and time (ISO 8601 format) when the price rule was created. |
updated_at
read-only |
The date and time (ISO 8601 format) when the price rule was updated. |
customer_selection |
The customer selection for the price rule. Valid values:
|
ends_at |
The date and time (ISO 8601 format) when the price rule ends. Must be after |
entitled_collection_ids |
A list of IDs of collections whose products will be eligible to the discount. It can be used only with
|
entitled_country_ids |
A list of IDs of shipping countries that will be entitled to the discount. It can be used only with |
entitled_product_ids |
A list of IDs of products that will be entitled to the discount. It can be used only with If a product variant is included in |
entitled_variant_ids |
A list of IDs of product variants that will be entitled to the discount. It can be used only with If a product is included in |
id
read-only |
The ID for the price rule. |
once_per_customer |
Whether the generated discount code will be valid only for a single use per customer. This is tracked using customer ID. |
prerequisite_customer_ids |
A list of customer IDs. For the price rule to be applicable, the customer must match one of the specified customers. If |
prerequisite_quantity_range |
The minimum number of items for the price rule to be applicable. It has the following property:
|
prerequisite_saved_search_ids |
A list of customer saved search IDs. For the price rule to be applicable, the customer must be in the group of customers matching a customer saved search. If |
prerequisite_shipping_price_range |
The maximum shipping price for the price rule to be applicable. It has the following property:
|
prerequisite_subtotal_range |
The minimum subtotal for the price rule to be applicable. It has the following property:
|
starts_at |
The date and time (ISO 8601 format) when the price rule starts. |
target_selection |
The target selection method of the price rule. Valid values:
|
target_type |
The target type that the price rule applies to. Valid values:
|
title |
The title of the price rule. This is used by the Shopify admin search to retrieve discounts. It is also displayed on the Discounts page of the Shopify admin for bulk discounts. For non-bulk discounts, the discount code is displayed on the admin. For a consistent search experience, use the same value for |
usage_limit |
The maximum number of times the price rule can be used, per discount code. |
prerequisite_product_ids |
List of product ids that will be a prerequisites for a Buy X Get Y type discount. The
CautionIf a product variant is included in |
prerequisite_variant_ids |
List of variant ids that will be a prerequisites for a Buy X Get Y type discount. The
CautionIf a product is included in |
prerequisite_collection_ids |
List of collection ids that will be a prerequisites for a Buy X Get Y discount. The
prerequisite_product_ids or prerequisite_variant_ids .
|
value |
The value of the price rule. If if the value of |
value_type |
The value type of the price rule. Valid values:
If |
prerequisite_to_entitlement_quantity_ratio |
Buy/Get ratio for a Buy X Get Y discount. The
CautionCannot be used in combination with |
allocation_limit |
The number of times the discount can be allocated on the cart - if eligible. For example a Buy 1 hat Get 1 hat for free discount can be applied 3 times on a cart having more than 6 hats, where maximum of 3 hats get discounted - if the Caution
|
Endpoints
Create a price rule that gives the buyer $10.00 off an order
POST /admin/api/2020-04/price_rules.json
{
"price_rule": {
"title": "SUMMERSALE10OFF",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341478,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:04-05:00",
"updated_at": "2021-01-01T14:39:04-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "SUMMERSALE10OFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341478"
}
}
Create a price rule that gives the buyer 15% off a specific collection
POST /admin/api/2020-04/price_rules.json
{
"price_rule": {
"title": "15OFFCOLLECTION",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "across",
"value_type": "percentage",
"value": "-15.0",
"customer_selection": "all",
"entitled_collection_ids": [
841564295
],
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341479,
"value_type": "percentage",
"value": "-15.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:05-05:00",
"updated_at": "2021-01-01T14:39:05-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [
841564295
],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "15OFFCOLLECTION",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341479"
}
}
Create a price rule that gives the buyer free shipping on orders over $50.00 that can be used up to 20 times
POST /admin/api/2020-04/price_rules.json
{
"price_rule": {
"title": "FREESHIPPING",
"target_type": "shipping_line",
"target_selection": "all",
"allocation_method": "each",
"value_type": "percentage",
"value": "-100.0",
"usage_limit": 20,
"customer_selection": "all",
"prerequisite_subtotal_range": {
"greater_than_or_equal_to": "50.0"
},
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341480,
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "shipping_line",
"target_selection": "all",
"allocation_method": "each",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": 20,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:06-05:00",
"updated_at": "2021-01-01T14:39:06-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": {
"greater_than_or_equal_to": "50.0"
},
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "FREESHIPPING",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341480"
}
}
Create a price rule that gives a select group of customers $5 off their order
POST /admin/api/2020-04/price_rules.json
{
"price_rule": {
"title": "5OFFCUSTOMERGROUP",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"value_type": "fixed_amount",
"value": "-5.0",
"customer_selection": "prerequisite",
"prerequisite_saved_search_ids": [
789629109
],
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341481,
"value_type": "fixed_amount",
"value": "-5.0",
"customer_selection": "prerequisite",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:07-05:00",
"updated_at": "2021-01-01T14:39:07-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [
789629109
],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "5OFFCUSTOMERGROUP",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341481"
}
}
Create a Buy X Get Y price rule that gives one free ipod touch if customer buys 2 ipods
POST /admin/api/2020-04/price_rules.json
{
"price_rule": {
"title": "Buy2iPodsGetiPodTouchForFree",
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "each",
"starts_at": "2018-03-22T00:00:00-00:00",
"prerequisite_collection_ids": [
841564295
],
"entitled_product_ids": [
921728736
],
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": 2,
"entitled_quantity": 1
},
"allocation_limit": 3
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341482,
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "each",
"allocation_limit": 3,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2018-03-21T20:00:00-04:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:08-05:00",
"updated_at": "2021-01-01T14:39:08-05:00",
"entitled_product_ids": [
921728736
],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [
841564295
],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": 2,
"entitled_quantity": 1
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "Buy2iPodsGetiPodTouchForFree",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341482"
}
}
Update the title of a price rule
PUT /admin/api/2020-04/price_rules/507328175.json
{
"price_rule": {
"id": 507328175,
"title": "WINTER SALE"
}
}
View Response
HTTP/1.1 200 OK
{
"price_rule": {
"id": 507328175,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-26T14:22:39-05:00",
"ends_at": "2021-01-07T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:38:59-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "WINTER SALE",
"admin_graphql_api_id": "gid://shopify/PriceRule/507328175"
}
}
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The maximum number of results to retrieve. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show price rules created after date (format 2017-03-25T16:15:47-04:00). |
created_at_max
|
Show price rules created before date (format 2017-03-25T16:15:47-04:00). |
updated_at_min
|
Show price rules last updated after date (format 2017-03-25T16:15:47-04:00). |
updated_at_max
|
Show price rules last updated before date (format 2017-03-25T16:15:47-04:00). |
starts_at_min
|
Show price rules starting after date (format 2017-03-25T16:15:47-04:00). |
starts_at_max
|
Show price rules starting before date (format 2017-03-25T16:15:47-04:00). |
ends_at_min
|
Show price rules ending after date (format 2017-03-25T16:15:47-04:00). |
ends_at_max
|
Show price rules ending before date (format 2017-03-25T16:15:47-04:00). |
times_used
|
Show price rules with times used. |
Retrieve all price rules
GET /admin/api/2020-04/price_rules.json
View Response
HTTP/1.1 200 OK
{
"price_rules": [
{
"id": 507328175,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-26T14:22:39-05:00",
"ends_at": "2021-01-07T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:22:39-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"title": "SUMMERSALE10OFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/507328175"
},
{
"id": 106886544,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-30T14:22:39-05:00",
"ends_at": "2021-01-03T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:22:39-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"title": "TENOFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/106886544"
}
]
}
Retrieve a single price rule by its ID
GET /admin/api/2020-04/price_rules/507328175.json
View Response
HTTP/1.1 200 OK
{
"price_rule": {
"id": 507328175,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-26T14:22:39-05:00",
"ends_at": "2021-01-07T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:22:39-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "SUMMERSALE10OFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/507328175"
}
}
Retrieve a count of all price rules
GET /admin/api/2020-04/price_rules/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
Delete a price rule
DELETE /admin/api/2020-04/price_rules/507328175.json
View Response
HTTP/1.1 204 No Content
You can use the PriceRule resource to create discounts using conditions. You can then associate the conditions with a discount code by using the DiscountCode resource. Merchants can distribute the discount codes to their customers.
Using the PriceRule resource, you can create discounts that specify a discount as a percentage, a fixed amount, or free shipping. You use entitlements and prerequisites to dynamically build these discounts.
To learn about how to associate a price rule with a discount code, see the DiscountCode resource.
Create a price rule
You can create price rules with entitlements and prerequisites. Entitlements describe the designated resources that a discount applies to, such as specific products, variants, or collections. Prerequisites describe the requirements that must be met in order for the discount to apply to the entitled resources. For example, you might want a discount to apply only to a certain shipping price range, or a certain subtotal range.
You can use entitlements, prereqisites, and other conditions to create discounts, such as the following examples:
- $10 off the buyer's order if the total exceeds $40
- 15% off certain collections
- free shipping on orders over $100.00 for Canadian buyers, redeemable up to 20 times
For examples of how to create price rules, see the POST method.
What you can do with PriceRule
The Shopify API lets you do the following with the PriceRule resource. More detailed versions of these general actions may be available:
- POST /admin/api/2020-07/price_rules.json Creates a price rule
- PUT /admin/api/2020-07/price_rules/{price_rule_id}.json Updates an existing a price rule
- GET /admin/api/2020-07/price_rules.json Retrieves a list of price rules
- GET /admin/api/2020-07/price_rules/{price_rule_id}.json Retrieves a single price rule
- GET /admin/api/2020-07/price_rules/count.json Retrieves a count of all price rules
- DELETE /admin/api/2020-07/price_rules/{price_rule_id}.json Remove an existing PriceRule
PriceRule properties
allocation_method |
The allocation method of the price rule. Valid values:
When the value of |
created_at
read-only |
The date and time (ISO 8601 format) when the price rule was created. |
updated_at
read-only |
The date and time (ISO 8601 format) when the price rule was updated. |
customer_selection |
The customer selection for the price rule. Valid values:
|
ends_at |
The date and time (ISO 8601 format) when the price rule ends. Must be after |
entitled_collection_ids |
A list of IDs of collections whose products will be eligible to the discount. It can be used only with
|
entitled_country_ids |
A list of IDs of shipping countries that will be entitled to the discount. It can be used only with |
entitled_product_ids |
A list of IDs of products that will be entitled to the discount. It can be used only with If a product variant is included in |
entitled_variant_ids |
A list of IDs of product variants that will be entitled to the discount. It can be used only with If a product is included in |
id
read-only |
The ID for the price rule. |
once_per_customer |
Whether the generated discount code will be valid only for a single use per customer. This is tracked using customer ID. |
prerequisite_customer_ids |
A list of customer IDs. For the price rule to be applicable, the customer must match one of the specified customers. If |
prerequisite_quantity_range |
The minimum number of items for the price rule to be applicable. It has the following property:
|
prerequisite_saved_search_ids |
A list of customer saved search IDs. For the price rule to be applicable, the customer must be in the group of customers matching a customer saved search. If |
prerequisite_shipping_price_range |
The maximum shipping price for the price rule to be applicable. It has the following property:
|
prerequisite_subtotal_range |
The minimum subtotal for the price rule to be applicable. It has the following property:
|
starts_at |
The date and time (ISO 8601 format) when the price rule starts. |
target_selection |
The target selection method of the price rule. Valid values:
|
target_type |
The target type that the price rule applies to. Valid values:
|
title |
The title of the price rule. This is used by the Shopify admin search to retrieve discounts. It is also displayed on the Discounts page of the Shopify admin for bulk discounts. For non-bulk discounts, the discount code is displayed on the admin. For a consistent search experience, use the same value for |
usage_limit |
The maximum number of times the price rule can be used, per discount code. |
prerequisite_product_ids |
List of product ids that will be a prerequisites for a Buy X Get Y type discount. The
CautionIf a product variant is included in |
prerequisite_variant_ids |
List of variant ids that will be a prerequisites for a Buy X Get Y type discount. The
CautionIf a product is included in |
prerequisite_collection_ids |
List of collection ids that will be a prerequisites for a Buy X Get Y discount. The
prerequisite_product_ids or prerequisite_variant_ids .
|
value |
The value of the price rule. If if the value of |
value_type |
The value type of the price rule. Valid values:
If |
prerequisite_to_entitlement_quantity_ratio |
Buy/Get ratio for a Buy X Get Y discount. The
CautionCannot be used in combination with |
allocation_limit |
The number of times the discount can be allocated on the cart - if eligible. For example a Buy 1 hat Get 1 hat for free discount can be applied 3 times on a cart having more than 6 hats, where maximum of 3 hats get discounted - if the Caution
|
Endpoints
Create a price rule that gives the buyer $10.00 off an order
POST /admin/api/2020-07/price_rules.json
{
"price_rule": {
"title": "SUMMERSALE10OFF",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341478,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:04-05:00",
"updated_at": "2021-01-01T14:39:04-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "SUMMERSALE10OFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341478"
}
}
Create a price rule that gives the buyer 15% off a specific collection
POST /admin/api/2020-07/price_rules.json
{
"price_rule": {
"title": "15OFFCOLLECTION",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "across",
"value_type": "percentage",
"value": "-15.0",
"customer_selection": "all",
"entitled_collection_ids": [
841564295
],
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341479,
"value_type": "percentage",
"value": "-15.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:05-05:00",
"updated_at": "2021-01-01T14:39:05-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [
841564295
],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "15OFFCOLLECTION",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341479"
}
}
Create a price rule that gives the buyer free shipping on orders over $50.00 that can be used up to 20 times
POST /admin/api/2020-07/price_rules.json
{
"price_rule": {
"title": "FREESHIPPING",
"target_type": "shipping_line",
"target_selection": "all",
"allocation_method": "each",
"value_type": "percentage",
"value": "-100.0",
"usage_limit": 20,
"customer_selection": "all",
"prerequisite_subtotal_range": {
"greater_than_or_equal_to": "50.0"
},
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341480,
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "shipping_line",
"target_selection": "all",
"allocation_method": "each",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": 20,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:06-05:00",
"updated_at": "2021-01-01T14:39:06-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": {
"greater_than_or_equal_to": "50.0"
},
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "FREESHIPPING",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341480"
}
}
Create a price rule that gives a select group of customers $5 off their order
POST /admin/api/2020-07/price_rules.json
{
"price_rule": {
"title": "5OFFCUSTOMERGROUP",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"value_type": "fixed_amount",
"value": "-5.0",
"customer_selection": "prerequisite",
"prerequisite_saved_search_ids": [
789629109
],
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341481,
"value_type": "fixed_amount",
"value": "-5.0",
"customer_selection": "prerequisite",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:07-05:00",
"updated_at": "2021-01-01T14:39:07-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [
789629109
],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "5OFFCUSTOMERGROUP",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341481"
}
}
Create a Buy X Get Y price rule that gives one free ipod touch if customer buys 2 ipods
POST /admin/api/2020-07/price_rules.json
{
"price_rule": {
"title": "Buy2iPodsGetiPodTouchForFree",
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "each",
"starts_at": "2018-03-22T00:00:00-00:00",
"prerequisite_collection_ids": [
841564295
],
"entitled_product_ids": [
921728736
],
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": 2,
"entitled_quantity": 1
},
"allocation_limit": 3
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341482,
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "each",
"allocation_limit": 3,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2018-03-21T20:00:00-04:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:08-05:00",
"updated_at": "2021-01-01T14:39:08-05:00",
"entitled_product_ids": [
921728736
],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [
841564295
],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": 2,
"entitled_quantity": 1
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "Buy2iPodsGetiPodTouchForFree",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341482"
}
}
Update the title of a price rule
PUT /admin/api/2020-07/price_rules/507328175.json
{
"price_rule": {
"id": 507328175,
"title": "WINTER SALE"
}
}
View Response
HTTP/1.1 200 OK
{
"price_rule": {
"id": 507328175,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-26T14:22:39-05:00",
"ends_at": "2021-01-07T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:38:59-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "WINTER SALE",
"admin_graphql_api_id": "gid://shopify/PriceRule/507328175"
}
}
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The maximum number of results to retrieve. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show price rules created after date (format 2017-03-25T16:15:47-04:00). |
created_at_max
|
Show price rules created before date (format 2017-03-25T16:15:47-04:00). |
updated_at_min
|
Show price rules last updated after date (format 2017-03-25T16:15:47-04:00). |
updated_at_max
|
Show price rules last updated before date (format 2017-03-25T16:15:47-04:00). |
starts_at_min
|
Show price rules starting after date (format 2017-03-25T16:15:47-04:00). |
starts_at_max
|
Show price rules starting before date (format 2017-03-25T16:15:47-04:00). |
ends_at_min
|
Show price rules ending after date (format 2017-03-25T16:15:47-04:00). |
ends_at_max
|
Show price rules ending before date (format 2017-03-25T16:15:47-04:00). |
times_used
|
Show price rules with times used. |
Retrieve all price rules
GET /admin/api/2020-07/price_rules.json
View Response
HTTP/1.1 200 OK
{
"price_rules": [
{
"id": 507328175,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-26T14:22:39-05:00",
"ends_at": "2021-01-07T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:22:39-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"title": "SUMMERSALE10OFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/507328175"
},
{
"id": 106886544,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-30T14:22:39-05:00",
"ends_at": "2021-01-03T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:22:39-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"title": "TENOFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/106886544"
}
]
}
Retrieve a single price rule by its ID
GET /admin/api/2020-07/price_rules/507328175.json
View Response
HTTP/1.1 200 OK
{
"price_rule": {
"id": 507328175,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2020-12-26T14:22:39-05:00",
"ends_at": "2021-01-07T14:22:39-05:00",
"created_at": "2021-01-01T14:22:39-05:00",
"updated_at": "2021-01-01T14:22:39-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "SUMMERSALE10OFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/507328175"
}
}
Retrieve a count of all price rules
GET /admin/api/2020-07/price_rules/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
Delete a price rule
DELETE /admin/api/2020-07/price_rules/507328175.json
View Response
HTTP/1.1 204 No Content
You can use the PriceRule resource to create discounts using conditions. You can then associate the conditions with a discount code by using the DiscountCode resource. Merchants can distribute the discount codes to their customers.
Using the PriceRule resource, you can create discounts that specify a discount as a percentage, a fixed amount, or free shipping. You use entitlements and prerequisites to dynamically build these discounts.
To learn about how to associate a price rule with a discount code, see the DiscountCode resource.
Create a price rule
You can create price rules with entitlements and prerequisites. Entitlements describe the designated resources that a discount applies to, such as specific products, variants, or collections. Prerequisites describe the requirements that must be met in order for the discount to apply to the entitled resources. For example, you might want a discount to apply only to a certain shipping price range, or a certain subtotal range.
You can use entitlements, prereqisites, and other conditions to create discounts, such as the following examples:
- $10 off the buyer's order if the total exceeds $40
- 15% off certain collections
- free shipping on orders over $100.00 for Canadian buyers, redeemable up to 20 times
For examples of how to create price rules, see the POST method.
What you can do with PriceRule
The Shopify API lets you do the following with the PriceRule resource. More detailed versions of these general actions may be available:
- POST /admin/api/2020-10/price_rules.json Creates a price rule
- PUT /admin/api/2020-10/price_rules/{price_rule_id}.json Updates an existing a price rule
- GET /admin/api/2020-10/price_rules.json Retrieves a list of price rules
- GET /admin/api/2020-10/price_rules/{price_rule_id}.json Retrieves a single price rule
- GET /admin/api/2020-10/price_rules/count.json Retrieves a count of all price rules
- DELETE /admin/api/2020-10/price_rules/{price_rule_id}.json Remove an existing PriceRule
PriceRule properties
allocation_method |
The allocation method of the price rule. Valid values:
When the value of |
created_at
read-only |
The date and time (ISO 8601 format) when the price rule was created. |
updated_at
read-only |
The date and time (ISO 8601 format) when the price rule was updated. |
customer_selection |
The customer selection for the price rule. Valid values:
|
ends_at |
The date and time (ISO 8601 format) when the price rule ends. Must be after |
entitled_collection_ids |
A list of IDs of collections whose products will be eligible to the discount. It can be used only with
|
entitled_country_ids |
A list of IDs of shipping countries that will be entitled to the discount. It can be used only with |
entitled_product_ids |
A list of IDs of products that will be entitled to the discount. It can be used only with If a product variant is included in |
entitled_variant_ids |
A list of IDs of product variants that will be entitled to the discount. It can be used only with If a product is included in |
id
read-only |
The ID for the price rule. |
once_per_customer |
Whether the generated discount code will be valid only for a single use per customer. This is tracked using customer ID. |
prerequisite_customer_ids |
A list of customer IDs. For the price rule to be applicable, the customer must match one of the specified customers. If |
prerequisite_quantity_range |
The minimum number of items for the price rule to be applicable. It has the following property:
|
prerequisite_saved_search_ids |
A list of customer saved search IDs. For the price rule to be applicable, the customer must be in the group of customers matching a customer saved search. If |
prerequisite_shipping_price_range |
The maximum shipping price for the price rule to be applicable. It has the following property:
|
prerequisite_subtotal_range |
The minimum subtotal for the price rule to be applicable. It has the following property:
|
prerequisite_to_entitlement_purchase |
The prerequisite purchase for a Buy X Get Y discount. It has the following property:
|
starts_at |
The date and time (ISO 8601 format) when the price rule starts. |
target_selection |
The target selection method of the price rule. Valid values:
|
target_type |
The target type that the price rule applies to. Valid values:
|
title |
The title of the price rule. This is used by the Shopify admin search to retrieve discounts. It is also displayed on the Discounts page of the Shopify admin for bulk discounts. For non-bulk discounts, the discount code is displayed on the admin. For a consistent search experience, use the same value for |
usage_limit |
The maximum number of times the price rule can be used, per discount code. |
prerequisite_product_ids |
List of product ids that will be a prerequisites for a Buy X Get Y type discount. The
CautionIf a product variant is included in |
prerequisite_variant_ids |
List of variant ids that will be a prerequisites for a Buy X Get Y type discount. The
CautionIf a product is included in |
prerequisite_collection_ids |
List of collection ids that will be a prerequisites for a Buy X Get Y discount. The
prerequisite_product_ids or prerequisite_variant_ids .
|
value |
The value of the price rule. If if the value of |
value_type |
The value type of the price rule. Valid values:
If |
prerequisite_to_entitlement_quantity_ratio |
Buy/Get ratio for a Buy X Get Y discount. The
CautionCannot be used in combination with |
allocation_limit |
The number of times the discount can be allocated on the cart - if eligible. For example a Buy 1 hat Get 1 hat for free discount can be applied 3 times on a cart having more than 6 hats, where maximum of 3 hats get discounted - if the Caution
|
Endpoints
Create a price rule that gives the buyer $10.00 off an order
POST /admin/api/2020-10/price_rules.json
{
"price_rule": {
"title": "SUMMERSALE10OFF",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341478,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:04-05:00",
"updated_at": "2021-01-01T14:39:04-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "SUMMERSALE10OFF",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341478"
}
}
Create a price rule that gives the buyer 15% off a specific collection
POST /admin/api/2020-10/price_rules.json
{
"price_rule": {
"title": "15OFFCOLLECTION",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "across",
"value_type": "percentage",
"value": "-15.0",
"customer_selection": "all",
"entitled_collection_ids": [
841564295
],
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341479,
"value_type": "percentage",
"value": "-15.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:05-05:00",
"updated_at": "2021-01-01T14:39:05-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [
841564295
],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "15OFFCOLLECTION",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341479"
}
}
Create a price rule that gives the buyer free shipping on orders over $50.00 that can be used up to 20 times
POST /admin/api/2020-10/price_rules.json
{
"price_rule": {
"title": "FREESHIPPING",
"target_type": "shipping_line",
"target_selection": "all",
"allocation_method": "each",
"value_type": "percentage",
"value": "-100.0",
"usage_limit": 20,
"customer_selection": "all",
"prerequisite_subtotal_range": {
"greater_than_or_equal_to": "50.0"
},
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341480,
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "shipping_line",
"target_selection": "all",
"allocation_method": "each",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": 20,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:06-05:00",
"updated_at": "2021-01-01T14:39:06-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": {
"greater_than_or_equal_to": "50.0"
},
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "FREESHIPPING",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341480"
}
}
Create a price rule that gives a select group of customers $5 off their order
POST /admin/api/2020-10/price_rules.json
{
"price_rule": {
"title": "5OFFCUSTOMERGROUP",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"value_type": "fixed_amount",
"value": "-5.0",
"customer_selection": "prerequisite",
"prerequisite_saved_search_ids": [
789629109
],
"starts_at": "2017-01-19T17:59:10Z"
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341481,
"value_type": "fixed_amount",
"value": "-5.0",
"customer_selection": "prerequisite",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across",
"allocation_limit": null,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2017-01-19T12:59:10-05:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:07-05:00",
"updated_at": "2021-01-01T14:39:07-05:00",
"entitled_product_ids": [],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [],
"prerequisite_saved_search_ids": [
789629109
],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": null,
"entitled_quantity": null
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "5OFFCUSTOMERGROUP",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341481"
}
}
Create a Buy X Get Y price rule that gives one free ipod touch if customer buys 2 ipods
POST /admin/api/2020-10/price_rules.json
{
"price_rule": {
"title": "Buy2iPodsGetiPodTouchForFree",
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "each",
"starts_at": "2018-03-22T00:00:00-00:00",
"prerequisite_collection_ids": [
841564295
],
"entitled_product_ids": [
921728736
],
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": 2,
"entitled_quantity": 1
},
"allocation_limit": 3
}
}
View Response
HTTP/1.1 201 Created
{
"price_rule": {
"id": 996341482,
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "each",
"allocation_limit": 3,
"once_per_customer": false,
"usage_limit": null,
"starts_at": "2018-03-21T20:00:00-04:00",
"ends_at": null,
"created_at": "2021-01-01T14:39:08-05:00",
"updated_at": "2021-01-01T14:39:08-05:00",
"entitled_product_ids": [
921728736
],
"entitled_variant_ids": [],
"entitled_collection_ids": [],
"entitled_country_ids": [],
"prerequisite_product_ids": [],
"prerequisite_variant_ids": [],
"prerequisite_collection_ids": [
841564295
],
"prerequisite_saved_search_ids": [],
"prerequisite_customer_ids": [],
"prerequisite_subtotal_range": null,
"prerequisite_quantity_range": null,
"prerequisite_shipping_price_range": null,
"prerequisite_to_entitlement_quantity_ratio": {
"prerequisite_quantity": 2,
"entitled_quantity": 1
},
"prerequisite_to_entitlement_purchase": {
"prerequisite_amount": null
},
"title": "Buy2iPodsGetiPodTouchForFree",
"admin_graphql_api_id": "gid://shopify/PriceRule/996341482"
}
}
Update the title of a price rule
PUT /admin/api/2020-10/price_rules/507328175.json
{
"price_rule": {
"id": 507328175,
"title": "WINTER SALE"
}
}
View Response
HTTP/1.1 200 OK
{
"price_rule": {
"id": 507328175,
"value_type": "fixed_amount",
"value": "-10.0",
"customer_selection": "all",
"target_type": "line_item",