I cannot find documentation that provides an example or work out how to add a customer to a discount code allow list.
Known:
- discount code configured for specific customers
- email address
Goal:
- Get or create customer with the email address
- Add customer to the discount code eligible customer list.
Thank you
lizk
2
Hi there 
Have you tried the discountCodeBasicUpdate mutation?
//Mutaion
mutation discountCodeBasicUpdate($id: ID!, $basicCodeDiscount: DiscountCodeBasicInput!) {
discountCodeBasicUpdate(id: $id, basicCodeDiscount: $basicCodeDiscount) {
codeDiscountNode {
codeDiscount {
... on DiscountCodeBasic {
title
codes(first: 10) {
nodes {
code
}
}
startsAt
endsAt
customerSelection {
... on DiscountCustomerAll {
allCustomers
}
}
customerGets {
value {
... on DiscountPercentage {
percentage
}
}
items {
... on AllDiscountItems {
allItems
}
}
}
appliesOncePerCustomer
}
}
}
userErrors {
field
code
message
}
}
}
// Variables
{
"id": "gid://shopify/DiscountCodeNode/1234",
"basicCodeDiscount": {
"customerSelection": {
"customers": {
"add": ["gid://Shopify/Customer/1234"]
}
}
}
}