beehexa integrationsidebar
beehexa logo

We Build HexaSync Integration Platform for Connecting ERP, POS, CRM, Accounting, and eCommerce Applications to Automate Business Processes

Shopify API – Create A Price Rule Using Postman In Shopify

Shopify API 2024 – Create A Price Rule Using Postman In Shopify

In Shopify, if you want to create a Discount, firstly, you need to create a Price rule using Postman. The price rule will allow you to know what value the discount is and 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 for the discount to apply to the eligible resources.

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

    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

       

        • Go to Apps – Manage private apps

      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.

          Shopify Connector and Profile arrow Brivity
          Shopify Brivity Integration
          Shopify Connector and Profile arrow Oracle
          Shopify Oracle Integration
          Shopify Connector and Profile arrow Zalo OA
          Shopify Zalo-oa Integration
          Shopify Connector and Profile arrow Tiki
          Shopify Tiki Integration

          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:

            https://{username}:{password}@{shop}.myshopify.com/admin/api/{api-version}/{resource}.json

               

                1. {username} – The API key that you generated.

                1. {password} – The API password that you generated.

                1. {shop} – The name of your development store.

                1. {api-version} – The supported API version that you want to use.

                1. {resource} – A resource endpoint from the REST Admin API.

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

              https://33a72f01e02987636e1c1a9a4e95c840:[email protected]/admin/api/2021-10/price_rules.json

              example URL

                 

                  • Paste the URL above.

                Post

                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"
                    }
                }

                Explain of parameters in the payload: 

                   

                    1. {Target_type} – There are 2 types: line_item and shipping_line

                    1. {Target_selection} – There are 2 selections: all and entitled

                    1. {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)

                    1. {value_type} – It can be a percentage, a fixed amount, or free shipping

                    1. {value} – The number of the discount value

                    1. {customer_selection} –  There are 2 selections: All and Prerequisite

                    1. {starts_at} – The date and time when the price rule was created.

                  Response:

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

                  response

                  I have shown you all steps to create a price rule with Shopify API using Postman. If you have any questions, please 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.

                  https://youtu.be/rLmG7vnmBvo
                  Shopify API | Lesson #8: Create A Price Rule Using Postman in Shopify

                  Hopefully, you can do it!

                  Table of Contents

                  Ready to integrate and automate at scale ?

                  Learn how HexaSync lets you build enterprise-grade integrations and automations without having to code.

                  Receive Exclusive Productivity Tips Directly in Your Inbox

                  We’ll email you 1-3 times per week—and never share your information.

                  Get started for free

                  You can’t add more hours to the day. Beehexa is the next best thing.