Is it possible to issue Discount Codes to specific customers when creating it through the API?

Shopify Partner
89 1 7

I am trying to use the Discount Code API to generate a new discount code when a customer places an order.

What I would like to do is generate the new code and tie it to the customer who placed the order.

With the Gift Card API it is possible to specify a customer id to achieve this, but the Discount Code API does not include this.

Is it possible to do this for discount codes at all?


Shopify Expert
9925 103 1763

Discount codes can be attached to customer groups.

Customer groups (created by saved searches in the customers page) are easy ways to send discount codes to a select group of customers. For example, if you want to send a discount code only to customers who have spent $100 or more in the last month, you can apply filters to create a group of these select customers, quickly grab their email addresses, generate a special code, and send it to these customers.

Take a look at the discounts API and the CustomerSavedSearch API.

★ Winning Partner of the Build a Business competition. ★
1 Like
Shopify Partner
89 1 7

Hi Jason,

Thanks for responding to my question.

I did see the CustomerSavedSearch API, but I am looking for a way to apply a discount code to an individual customer upon successful checkout.

Through the Discount API I can generate the discount code, but there does not seem to be a way to attach that code to the customer that completed the checkout.

One of our team floated the idea of trying to pass the discount code information through a metafield attached to the customer. Would this work as a workaround?

6 0 1

Hi there,

I'm trying to set up a discount code for new customers only, so customers who have never ordered before.  Essentially I'm trying to set up a negative criteria, so that all current/previous customers are excluded from using the discount code.  Is this possible at all?



New Member
2 0 0

Aloha Jason,

I sent out an email campaign telling our customers we will send them (individually in email response) a coupon/discount code after they send us a testimonial as our thanks to them for sharing their experience with our products.


i noticed after making the discount code, it was being applied automatically to all orders.  


how can i made a specific discount code for specific individuals to send back to them in our email response?

how do i make the code without it being applied to every order automatically?


thank you so very much for your time.