Create a Customer Specific Promotion
This walkthrough shows you how to create and use a customer specific promotion.
Prerequisites
- Ensure that you use the customers
customer ID
in theuser
field when you add the promotion code to the promotion configuration. For more information, see Customers.
Step-by-step walkthrough
- Create a customer specific promotion.
- Create the coupon for a specific customer.
- Apply the coupon code.
Create a customer specific promotion
Create the promotion for the customer using the Create Promotion documentation.
note
When creating a promotion, the automatic
field is set to false
and will automatically apply the coupon at checkout. If you do not want this default behaviour, set the automatic
field to true
.
Creating coupon for a specific customer
Create the promotion code for the specific customer. In the following example, the data shows the codes created for a shopper. For more information, see Create Promotion Codes.
note
Ensure that you use the customer ID in the user
field.
{
"data": {
"type": "promotion_codes",
"codes": [
{
"code": "2021LOYALTY",
"user": "794f8c8a-e073-488d-855d-705eb33fa870",
"uses": 1
},
{
"code": "2021PREFERREDCUSTOMER"
}
]
}
}
Apply the coupon code
Finally, apply the coupon code to the cart for the specific customer account. Add the x-moltin-customer-token
header in the request so the customer can authenticate to the site to use the promotion. For more information, see Create Promotion Codes.