How to integrate with the Shopify Discount Code API

Shopify is an all-in-one commerce platform, powering millions of businesses worldwide.

Digioh’s Shopify Discount API integration helps us to create coupons code dynamically in Shopify using the Shopify discount code API.

Requirements:

  • Shopify API Token.
  • Shopify Discount Code Price Rule ID

First, you must generate an access token that will pass with the Discount code API request for authentication. Learn how to generate a Shopify API token here.

Generating the Access token requires creating a private App In Shopify. Unlike public apps built to work for many stores, private apps are built exclusively for your Shopify store. You can use private apps to add features to your Shopify admin, access your store’s data directly using Shopify’s APIs, or extend your online store to other platforms using custom storefronts. Learn more about Shopify private apps here.

How to create the Shopify access token:

1. Log into your Shopify Store.

log into your shopify store

2. Click the Apps link in the sidebar menu.

click apps on the left side of the page

3. Click Develop apps for your Store.

develop apps for your shopify store

4. Open the Private Apps page and click Create an app.

click create an app on the app development page

5. Clicking Create an app opens the create private app modal. Fill in the app details. Allow admin permission for Discount Resource while creating the private app.

create an app in shopify 

6. After creating the app, you will be redirected to the private app’s page. Select Configure admin API scopes.

configure admin api scopes in shopify app

7. On the Admin API access scopes page, search Discount code. Check the “read discount” and “write discounts” options.

check write discounts and read discounts on the Admin API access scopes page

8. On the Admin API access scopes page, search Price Rules. Check the “write_price_rules” and “read_price_rules” options.

check the write price rules and read price rules boxes on the Admin API access scopes page

9. Click Save.

10. Click the Install App button to install your created app.

install discount code api app

11. After Installation, copy the API password that will be used as an access token while calling the Discount code API. Check the below screenshot.

shopify api access token

You can also check the above steps in this Video 

To create the discount click on discount and click the create discount button.

Discount

After that you’d have to select type of discount.

Type of discount

After that you have to define the coupon code use-case. We generally suggest using method Discount code then click on generate random code.
And the rest of the items depend on your needs. If you want users to spend 60$ and give them 15% discount, Add it there per the screenshot

Product discount

Shopify Price Rule ID:

The price rule ID will be found in the URL of the discount code.

price rule id in shopify

Note: You have to create a discount code for getting the price rule ID if it’s not already been created. 

Once you send the access Token and Price Rule ID to Digioh, our API integration team will set up this integration.