I want to have the email confirmation to include a coupon code based on the product purchased. I have 3 products and 3 separate discount codes. Is that possible?
Hey there!
I think you could use the product metafields to achieve this. Create new Metafields for your products and than call the object in your confirmation template. It should be accessible through:
line.product.metafields
You should also add a logic what happens if the customer buys 2 or 3 products at once. Does he get 3 codes or just 1?
The only problem I see is that I think that only your customer should be able to use the discount code, right? If thats the case it wont be possible to achieve this automatically.