Discussing APIs and development related to customers, discounts, and order management.
I cannot find documentation that provides an example or work out how to add a customer to a discount code allow list.
Known:
Goal:
Thank you
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"]
}
}
}
}
To learn more visit the Shopify Help Center or the Community Blog.