Coupon Code
{% if customer.last_order %}
{% comment %}Convert price to number and calculate coupons (1 per 1000 spent){% endcomment %}
{% assign order_total = customer.last_order.total_price | divided_by: 100 %}
{% assign coupon_count = order_total | divided_by: 1000 | floor %}
{% comment %}The list of alphabets to use for suffixes{% endcomment %}
{% assign alphabets = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z" | split: "," %}
{% else %}
{% endif %}
Valentine's Day Lucky Draw 🃏
{% if coupon_count > 0 %}Hi {{ customer.first_name }}, thanks for your order!
Total Spend: {{ customer.last_order.total_price | money }}
You have earned {{ coupon_count }} Coupons!
{% for i in (1..coupon_count) %}
{% assign index = i | minus: 1 %}
{% comment %}Extract only the number from the order name (e.g., #KOC555 -> 555){% endcomment %}
{% assign order_num = customer.last_order.name | remove: "#" | remove: "KOC" | remove: "koc" %}
🎟️ KOC{{ order_num }}{{ alphabets[index] }}
{% endfor %}
Winners will be announced on 19th Feb 2026!
{% else %}Your order total was {{ customer.last_order.total_price | money }}.
Note: Spend ₹1,000+ to earn a Lucky Draw coupon. Better luck next time!
{% endif %}
