Shopify API – Create A Price Rule Using Postman In Shopify

Shopify API – Create A Price Rule Using Postman In Shopify

In Shopify, if you want to use Postman to create a Discount, firstly you need to create a Price rule. The price rule will allow you to know what value of the discount, when and how you can apply it to customers.

Price rules have 2 ingredients: Entitlements and prerequisites. You can understand as follows:

  • Entitlements are the precise resources to which a discount applies, such as goods, variations, or collections. 
  • Prerequisites are the conditions that must be satisfied in order for the discount to apply to the resources that are eligible.

Example: Free Shipping for all customers buying over $50.

Now, I will show you how to create a price rule that gives the buyer $10 for an order. 

Step 1: Generate API credentials from the Shopify admin

Generate API credentials from the Shopify admin
  • Click Create a new private app
  • In the App details section, enter a name for your app, and an emergency developer email
  • In the Admin API section, select the areas of your store that you want the app to access
Generate API credentials from the Shopify admin
  • Click Save

The Admin API section displays the app’s API key and password when you save the app’s details.

Step 2: Create A Price Rule Using Postman In Shopify

  • Log in to your Postman and create a new workspace
  • Create a new POST with this URL:
Code language: JavaScript (javascript)
  1. {username} – The API key that you generated.
  2. {password} – The API password that you generated.
  3. {shop} – The name of your development store.
  4. {api-version} – The supported API version that you want to use.
  5. {resource} – A resource endpoint from the REST Admin API.

Or you can copy this example in the Shopify Admin, remember change {resource} to {price_rules}:

https://33a72f01e02987636e1c1a9a4e95c840:[email protected]/admin/api/2021-10/price_rules.json
Code language: JavaScript (javascript)
example URL
  • Paste the URL above.

In the body section, enter this code, then click Send.

{ "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": "2021-12-10T13:00:10Z" } }
Code language: JSON / JSON with Comments (json)

Explain of parameters in the payload: 

  1. {Target_type} – There are 2 types: line_item and shipping_line
  2. {Target_selection} – There are 2 selections: all and entitled
  3. {allocation_method} – There are 2 methods (Each method: The discount is applied to each of the entitled items. Cross method: The calculated discount amount will be applied across the entitled items)
  4. {value_type} – It can be a percentage, a fixed amount, or free shipping
  5. {value} – The number of the discount value
  6. {customer_selection} –  There are 2 selections: All and Prerequisite
  7. {starts_at} – The date and time when the price rule was created.


The API will return all information about the created price rule.


I have shown you all steps to create a price rule with Shopify API using Postman. If you have any questions please leave a comment below or refer to our Devdocs

If you still do not understand the tutorial’s content, you can watch the video below for a more overview.

Shopify API | Lesson #8: Create A Price Rule Using Postman in Shopify

Hopefully, you can do it!

Related Articles

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email