You can show the code of a coupon used in an order by using the order.coupon.code variable in the Order Template.
Here is an example of how you can modify the default Order Template to show the coupon code if a coupon is used in an order:
Default Code
{% if order.uses_coupon? %}
<tr>
<td class="heading">Coupon Discount</td>
<td class="qty">{{ order.coupon_discount_inc_tax | simple_price_format }}</td>
</tr>
{% endif %}
Custom Code
Add the code in red to the default code shown above as follows:
{% if order.uses_coupon? %}
<tr>
<td class="heading">Coupon Discount ({{ order.coupon.code }})</td>
<td class="qty">{{ order.coupon_discount_inc_tax | simple_price_format }}</td>
</tr>
{% endif %}
Comments
0 comments
Please sign in to leave a comment.