Shopify Admin API
  1. PriceRule
Shopify Admin API
  • Customers
    • Customer Address
      • Retrieves a list of addresses for a customer
      • Creates a new address for a customer
      • Retrieves details for a single customer address
      • Updates an existing customer address
      • Removes an address from a customer’s address list
      • Performs bulk operations for multiple customer addresses
      • Sets the default address for a customer
    • CustomerSavedSearch
      • Retrieves a list of customer saved searches
      • Creates a customer saved search
      • Retrieves a count of all customer saved searches
      • Retrieves a single customer saved search
      • Updates a customer saved search
      • Deletes a customer saved search
      • Retrieves all customers returned by a customer saved search
    • Customer
      • Retrieves a list of customers
      • Creates a customer
      • Searches for customers that match a supplied query
      • Retrieves a single customer
      • Updates a customer
      • Deletes a customer
      • Creates an account activation URL for a customer
      • Sends an account invite to a customer
      • Retrieves a count of customers
      • Retrieves all orders that belong to a customer
  • Sales channels
    • Checkout
      • Creates a checkout
      • Completes a checkout
      • Retrieves a checkout
      • Modifies an existing checkout
      • Retrieves a list of shipping rates
    • CollectionListing
      • Retrieve collection listings that are published to your app
      • Retrieve product_ids that are published to a collection_id
      • Retrieve a specific collection listing that is published to your app
      • Create a collection listing to publish a collection to your app
      • Delete a collection listing to unpublish a collection from your app
    • Product ResourceFeedback
      • Create a new Product ResourceFeedback
      • Receive a list of all Product ResourceFeedbacks
    • MobilePlatformApplication
      • List all of the mobile platform applications associated with the app
      • Create a mobile platform application
      • Get a mobile platform application
      • Update a mobile platform application
      • Delete a mobile platform application
    • ProductListing
      • Retrieve product listings that are published to your app
      • Retrieve product_ids that are published to your app
      • Retrieve a count of products that are published to your app
      • Retrieve a specific product listing that is published to your app
      • Create a product listing to publish a product to your app
      • Delete a product listing to unpublish a product from your app
    • ResourceFeedback
      • Create a new ResourceFeedback
      • Receive a list of all ResourceFeedbacks
    • Payment
      • Creates a new payment
      • Retrieves a list of payments on a particular checkout
      • Retrieves a single payment
      • Counts the number of payments attempted on a checkout
  • Products
    • Collect
      • Adds a product to a custom collection
      • Retrieves a list of collects
      • Removes a product from a collection
      • Retrieves a specific collect by its ID
      • Retrieves a count of collects
    • Collection
      • Retrieves a single collection
      • Retrieve a list of products belonging to a collection
    • CustomCollection
      • Retrieves a list of custom collections
      • Creates a custom collection
      • Retrieves a count of custom collections
      • Retrieves a single custom collection
      • Updates an existing custom collection
      • Deletes a custom collection
    • Product
      • Retrieve a list of products
      • Create a new product
      • Retrieve a count of products
      • Retrieve a single product
      • Updates a product
      • Delete a product
    • Product Image
      • Receive a list of all Product Images
      • Create a new Product Image
      • Receive a count of all Product Images
      • Receive a single Product Image
      • Modify an existing Product Image
      • Remove an existing Product Image
    • Product Variant
      • Retrieves a list of product variants
      • Create a new Product Variant
      • Receive a count of all Product Variants
      • Receive a single Product Variant
      • Modify an existing Product Variant
      • Remove an existing Product Variant
    • SmartCollection
      • Retrieves a list of smart collections
      • Creates a smart collection
      • Retrieves a count of smart collections
      • Retrieves a single smart collection
      • Updates an existing smart collection
      • Removes a smart collection
      • Updates the ordering type of products in a smart collection
  • Orders
    • Abandoned checkouts
      • Retrieves a list of abandoned checkouts
    • DraftOrder
      • Create a new DraftOrder
      • Retrieves a list of draft orders
      • Modify an existing DraftOrder
      • Receive a single DraftOrder
      • Remove an existing DraftOrder
      • Receive a count of all DraftOrders
      • Send an invoice
      • Complete a draft order
    • Order Risk
      • Creates an order risk for an order
      • Retrieves a list of all order risks for an order
      • Retrieves a single order risk by its ID
      • Updates an order risk
      • Deletes an order risk for an order
    • Transaction
      • Retrieves a list of transactions
      • Creates a transaction for an order
      • Retrieves a count of an order's transactions
      • Retrieves a specific transaction
    • Order
      • Retrieve a list of orders
      • Create an order
      • Retrieve a specific order
      • Update an order
      • Delete an order
      • Retrieve an order count
      • Close an order
      • Re-open a closed order
      • Cancel an order
    • Refund
      • Retrieves a list of refunds for an order
      • Creates a refund
      • Retrieves a specific refund
      • Calculates a refund
  • Access
    • AccessScope
      • Get a list of access scopes
    • StorefrontAccessToken
      • Creates a new StorefrontAccessToken
      • Retrieves a list of storefront access tokens that have been issued
      • Deletes an existing storefront access token
  • Billing
    • ApplicationCredit
      • Creates an application credit
      • Retrieves all application credits
      • Retrieves a single application credit
    • ApplicationCharge
      • Creates an application charge
      • Retrieves a list of application charges
      • Retrieves an application charge
    • UsageCharge
      • Creates a usage charge
      • Retrieves a list of usage charges
      • Retrieves a single charge
    • RecurringApplicationCharge
      • Creates a recurring application charge
      • Retrieves a list of recurring application charges
      • Retrieves a single charge
      • Cancels a recurring application charge
      • Updates the capped amount of a recurring application charge
  • Online store
    • Asset
      • Retrieves a single asset for a theme
      • Creates or updates an asset for a theme
      • Deletes an asset from a theme
    • Blog
      • Retrieve a list of all blogs
      • Create a new Blog
      • Receive a count of all Blogs
      • Receive a single Blog
      • Modify an existing Blog
      • Remove an existing Blog
    • Article
      • Retrieves a list of all articles from a blog
      • Creates an article for a blog
      • Retrieves a count of all articles from a blog
      • Receive a single Article
      • Updates an article
      • Deletes an article
      • Retrieves a list of all article authors
      • Retrieves a list of all article tags
      • Retrieves a list of all article tags from a specific blog
    • Redirect
      • Retrieves a list of URL redirects
      • Creates a redirect
      • Retrieves a count of URL redirects
      • Retrieves a single redirect
      • Updates an existing redirect
      • Deletes a redirect
    • Comment
      • Retrieves a list of comments
      • Creates a comment for an article
      • Retrieves a count of comments
      • Retrieves a single comment by its ID
      • Updates a comment of an article
      • Marks a comment as spam
      • Marks a comment as not spam
      • Approves a comment
      • Removes a comment
      • Restores a previously removed comment
    • ScriptTag
      • Retrieves a list of all script tags
      • Creates a new script tag
      • Retrieves a count of all script tags
      • Retrieves a single script tag
      • Updates a script tag
      • Deletes a script tag
    • Page
      • Retrieves a list of pages
      • Creates a page
      • Retrieves a page count
      • Retrieves a single page by its ID
      • Updates a page
      • Deletes a page
    • Theme
      • Retrieves a list of themes
      • Creates a theme
      • Retrieves a single theme by its ID
      • Modify an existing Theme
      • Remove an existing Theme
  • Shipping and fulfillment
    • CancellationRequest
      • Sends a cancellation request
      • Accepts a cancellation request
      • Rejects a cancellation request
    • CarrierService
      • Create a new CarrierService
      • Receive a list of all CarrierServices
      • Modify an existing CarrierService
      • Receive a single CarrierService
      • Remove an existing CarrierService
    • AssignedFulfillmentOrder
      • Retrieves a list of fulfillment orders on a shop for a specific app
    • FulfillmentEvent
      • Retrieves a list of fulfillment events for a specific fulfillment
      • Creates a fulfillment event
      • Retrieves a specific fulfillment event
      • Deletes a fulfillment event
    • Fulfillment
      • Retrieves fulfillments associated with an order
      • Retrieves fulfillments associated with a fulfillment order
      • Retrieves a count of fulfillments associated with a specific order
      • Receive a single Fulfillment
      • Creates a fulfillment for one or many fulfillment orders
      • Updates the tracking information for a fulfillment
      • Cancels a fulfillment
    • FulfillmentOrder
      • Retrieves a list of fulfillment orders for a specific order
      • Retrieves a specific fulfillment order
      • Cancel a fulfillment order
      • Marks a fulfillment order as incomplete
      • Moves a fulfillment order to a new location
      • Marks the fulfillment order as open
      • Reschedules the fulfill_at time of a scheduled fulfillment order
      • Applies a fulfillment hold on an open fulfillment order
      • Sets deadline for fulfillment orders
      • Releases the fulfillment hold on a fulfillment order
    • LocationsForMove
      • Retrieves a list of locations that a fulfillment order can potentially move to.
    • FulfillmentRequest
      • Sends a fulfillment request
      • Accepts a fulfillment request
      • Rejects a fulfillment request
    • FulfillmentService
      • Receive a list of all FulfillmentServices
      • Create a new FulfillmentService
      • Receive a single FulfillmentService
      • Modify an existing FulfillmentService
      • Remove an existing FulfillmentService
  • Shopify Payments
    • Balance
      • Return the current balance
    • Dispute
      • Return a list of all disputes
      • Return a single dispute
    • Payouts
      • Return a list of all payouts
      • Return a single payout
    • Transactions
      • Return a list of all balance transactions
  • Analytics
    • Report
      • Retrieves a list of reports
      • Creates a new report
      • Retrieves a single report
      • Updates a report
      • Deletes a report
  • Deprecated API calls
    • Deprecated API calls
      • Retrieves a list of deprecated API calls
  • Discounts
    • DiscountCode
      • Creates a discount code
      • Retrieves a list of discount codes
      • Updates an existing discount code
      • Retrieves a single discount code
      • Deletes a discount code
      • Retrieves the location of a discount code
      • Retrieves a count of discount codes for a shop
      • Creates a discount code creation job
      • Retrieves a discount code creation job
      • Retrieves a list of discount codes for a discount code creation job
    • PriceRule
      • Creates a price rule
        POST
      • Retrieves a list of price rules
        GET
      • Updates an existing a price rule
        PUT
      • Retrieves a single price rule
        GET
      • Remove an existing PriceRule
        DELETE
      • Retrieves a count of all price rules
        GET
  • Inventory
    • InventoryItem
      • Retrieves a detailed list for inventory items by IDs
      • Retrieves a single inventory item by ID
      • Updates an existing inventory item
    • Location
      • Retrieve a list of locations
      • Retrieve a single location by its ID
      • Retrieve a count of locations
      • Retrieve a list of inventory levels for a location
    • InventoryLevel
      • Retrieves a list of inventory levels
      • Deletes an inventory level from a location
      • Adjusts the inventory level of an inventory item at a location
      • Connects an inventory item to a location
      • Sets the inventory level for an inventory item at a location
  • Events
    • Event
      • Retrieves a list of events
      • Retrieves a single event
      • Retrieves a count of events
    • Webhook
      • Retrieves a list of webhooks
      • Create a new Webhook
      • Receive a count of all Webhooks
      • Receive a single Webhook
      • Modify an existing Webhook
      • Remove an existing Webhook
  • MarketingEvent
    • MarketingEvent
      • Retrieves a list of all marketing events
      • Creates a marketing event
      • Retrieves a count of all marketing events
      • Retrieves a single marketing event
      • Updates a marketing event
      • Deletes a marketing event
      • Creates marketing engagements on a marketing event
  • Metafield
    • Metafield
      • Retrieve a list of metafields from the resource's endpoint
      • Create a metafield
      • Retrieve a list of metafields by using query parameters
      • Retrieve a count of a resource's metafields.
      • Retrieve a specific metafield
      • Updates a metafield
      • Deletes a metafield by its ID
  • Plus
    • Gift Card
      • Retrieves a list of gift cards
      • Creates a gift card
      • Retrieves a single gift card
      • Updates an existing gift card
      • Retrieves a count of gift cards
      • Disables a gift card
      • Searches for gift cards
    • User
      • Retrieves a list of all users
      • Retrieves a single user
      • Retrieves the currently logged-in user
  • Store properties
    • Country
      • Receive a list of all Countries
      • Creates a country
      • Retrieves a count of countries
      • Retrieves a specific county
      • Updates an existing country
      • Remove an existing Country
    • Currency
      • Retrieves a list of currencies enabled on a shop
    • Policy
      • Retrieves a list of the shop's policies
    • ShippingZone
      • Receive a list of all ShippingZones
    • Province
      • Retrieves a list of provinces for a country
      • Retrieves a count of provinces for a country
      • Retrieves a single province for a country
      • Updates an existing province for a country
    • Shop
      • Retrieves the shop's configuration
  • TenderTransaction
    • TenderTransaction
      • Retrieves a list of tender transactions
  1. PriceRule

Retrieves a list of price rules

GET
/admin/api/{api_version}/price_rules.json
Retrieves a list of price rules. Note: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the page parameter will return an error. To learn more, see Make paginated requests to the REST Admin API.

请求参数

Path 参数
api_version
string 
必需
Query 参数
created_at_max
string 
可选
Show price rules created before date (format 2017-03-25T16:15:47-04:00).
created_at_min
string 
可选
Show price rules created after date (format 2017-03-25T16:15:47-04:00).
ends_at_max
string 
可选
Show price rules ending before date (format 2017-03-25T16:15:47-04:00).
ends_at_min
string 
可选
Show price rules ending after date (format 2017-03-25T16:15:47-04:00).
limit
string 
可选
The maximum number of results to retrieve.
since_id
string 
可选
Restrict results to after the specified ID.
starts_at_max
string 
可选
Show price rules starting before date (format 2017-03-25T16:15:47-04:00).
starts_at_min
string 
可选
Show price rules starting after date (format 2017-03-25T16:15:47-04:00).
times_used
string 
可选
Show price rules with times used.
updated_at_max
string 
可选
Show price rules last updated before date (format 2017-03-25T16:15:47-04:00).
updated_at_min
string 
可选
Show price rules last updated after date (format 2017-03-25T16:15:47-04:00).

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request GET 'https://demo.myshopify.com//admin/api//price_rules.json'

返回响应

🟢200Retrieves a list of price rules
application/json
Body
price_rules
array[object (PriceRule) {29}] 
可选
allocation_method
string 
可选
The allocation method of the price rule. Valid values:
  • each: The discount is applied to each of the entitled items. For example, for a price rule that takes 15off,eachentitledlineiteminacheckoutwillbediscountedby15.
  • across: The calculated discount amount will be applied across the entitled items. For example, for a price rule
    that takes $15 off, the discount will be applied across all the entitled items.
When the value of target_type is shipping_line, then this value must be each.
created_at
string 
只读可选
The date and time (ISO 8601 format) when the price rule was created.
updated_at
string 
只读可选
The date and time (ISO 8601 format) when the price rule was updated.
customer_selection
enum<string> 
可选
The customer selection for the price rule.
枚举值:
allprerequisite
ends_at
string 
可选
The date and time (ISO 8601 format) when the price rule ends. Must be after starts_at.
entitled_collection_ids
string 
可选
A list of IDs of collections whose products will be eligible to the discount. It can be used only with
target_type set to line_item and target_selection set to entitled.
It can't be used in combination with entitled_product_ids or entitled_variant_ids.
示例值:
45646548698979761006
entitled_country_ids
string 
可选
A list of IDs of shipping countries that will be entitled to the discount. It can be used only with target_type set to shipping_line and target_selection set to entitled.
entitled_product_ids
string 
可选
A list of IDs of products that will be entitled to the discount. It can be used only with target_type set to line_item
and target_selection set to entitled.
If a product variant is included in entitled_variant_ids, then entitled_product_ids can't include the ID of the product associated with that variant.
示例值:
789739775542382368242
entitled_variant_ids
string 
可选
A list of IDs of product variants that will be entitled to the discount. It can be used only with target_type set to line_item
and target_selection set to entitled.
If a product is included in entitled_product_ids, then entitled_variant_ids can't include the ID of any variants associated with that product.
示例值:
67987987985675765905
id
string 
只读可选
The ID for the price rule.
once_per_customer
string 
可选
Whether the generated discount code will be valid only for a single use per customer. This is tracked using customer ID.
prerequisite_customer_ids
string 
可选
A list of customer IDs. For the price rule to be applicable, the customer must match one of the specified customers.
If prerequisite_customer_ids is populated, then customer_segment_prerequisite_ids must be empty.
示例值:
3840283490053492039843
prerequisite_quantity_range
string 
可选
The minimum number of items for the price rule to be applicable. It has the following property:
  • greater_than_or_equal_to: The quantity of an entitled cart item must be greater than or equal to this value.
customer_segment_prerequisite_ids
string 
可选
A list of customer segment IDs. For the price rule to be applicable, the customer must be in the group of customers matching a customer segment.
If customer_segment_prerequisite_ids is populated, then prerequisite_customer_ids must be empty.
示例值:
112234543243535360314
prerequisite_shipping_price_range
string 
可选
The maximum shipping price for the price rule to be applicable. It has the following property:
  • less_than_or_equal_to: The shipping price must be less than or equal to this value.
prerequisite_subtotal_range
string 
可选
The minimum subtotal for the price rule to be applicable. It has the following property:
  • greater_than_or_equal_to: The subtotal of the entitled cart items must be greater than or equal to this value for the discount to apply.
prerequisite_to_entitlement_purchase
string 
可选
The prerequisite purchase for a Buy X Get Y discount. It has the following property:
  • prerequisite_amount: The minimum purchase amount required to be entitled to the discount.
starts_at
string 
可选

The date and time (ISO 8601 format) when the price rule starts.

target_selection
enum<string> 
可选
The target selection method of the price rule.
枚举值:
allentitled
target_type
enum<string> 
可选
The target type that the price rule applies to.
枚举值:
line_itemshipping_line
title
string 
可选
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 title as the code property of the associated discount code.
usage_limit
string 
可选
The maximum number of times the price rule can be used, per discount code.
prerequisite_product_ids
string 
可选
List of product ids that will be a prerequisites for a Buy X Get Y type discount. The prerequisite_product_ids can be used only with:
  • target_type set to line_item,
  • target_selection set to entitled,
  • allocation_method set to each and
  • prerequisite_to_entitlement_quantity_ratio defined.

Caution

If a product variant is included in prerequisite_variant_ids, then prerequisite_product_ids can't include the ID of the product associated with that variant.
示例值:
789739775542382368242
prerequisite_variant_ids
string 
可选
List of variant ids that will be a prerequisites for a Buy X Get Y type discount. The entitled_variant_ids can be used only with:
  • target_type set to line_item,
  • target_selection set to entitled,
  • allocation_method set to each and
  • prerequisite_to_entitlement_quantity_ratio defined.

Caution

If a product is included in prerequisite_product_ids, then prerequisite_variant_ids can't include the ID of any variants associated with that product.
示例值:
67987987985675765905
prerequisite_collection_ids
string 
可选

List of collection ids that will be a prerequisites for a Buy X Get Y discount. The entitled_collection_ids can be used only with:

  • target_type set to line_item,
  • target_selection set to entitled,
  • allocation_method set to each and
  • prerequisite_to_entitlement_quantity_ratio defined.
Cannot be used in combination with prerequisite_product_ids or prerequisite_variant_ids.

示例值:
45646548698979761006
value
string 
可选
The value of the price rule. If if the value of target_type is shipping_line, then only -100 is accepted.
The value must be negative.
value_type
enum<string> 
可选
The value type of the price rule.
枚举值:
percentage
prerequisite_to_entitlement_quantity_ratio
string 
可选
Buy/Get ratio for a Buy X Get Y discount. prerequisite_quantity defines the necessary 'buy' quantity and entitled_quantity the offered 'get' quantity.
The prerequisite_to_entitlement_quantity_ratio can be used only with:
  • value_type set to percentage,
  • target_type set to line_item,
  • target_selection set to entitled,
  • allocation_method set to each,
  • prerequisite_product_ids or prerequisite_variant_ids or prerequisite_collection_ids defined and
  • entitled_product_ids or entitled_variant_ids or entitled_collection_ids defined.

Caution

Cannot be used in combination with prerequisite_subtotal_range, prerequisite_quantity_range or prerequisite_shipping_price_range.
allocation_limit
string 
可选
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 allocation_limit is 3. Empty (null) allocation_limit means unlimited number of allocations.

Caution

allocation_limit is only working with Buy X Get Y discount. The default value on creation will be null (unlimited).
示例
{
    "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": "2022-12-28T12:05:09-05:00",
            "ends_at": "2023-01-09T12:05:09-05:00",
            "created_at": "2023-01-03T12:05:09-05:00",
            "updated_at": "2023-01-03T12:05:09-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": "2023-01-01T12:05:09-05:00",
            "ends_at": "2023-01-05T12:05:09-05:00",
            "created_at": "2023-01-03T12:05:09-05:00",
            "updated_at": "2023-01-03T12:05:09-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"
        }
    ]
}
修改于 2023-01-29 12:00:31
上一页
Creates a price rule
下一页
Updates an existing a price rule
Built with