{if !shopDiscounts::isEnabled('coupons')}
{sprintf('[`Discounts by coupons are turned off. Enable discounts in your store settings.`]', "`$marketing_url`discounts/coupons/")}
{/if}
{if $formatted_value}
{$formatted_value}
{/if}

{$coupon.code|escape} {if $coupon.id && !$is_enabled}[`Unavailable`]{/if}

{if $coupon.id}

[`Created`] {$coupon.create_datetime|wa_date:"humandate"}

{/if}
[`Coupon code`]
[`Coupon type`]
%

[`Discount will be calculated automatically to match the order shipping cost.`]

[`Max number of usage`]

[`Enter the maximum number of times this coupon can be used. Leave empty for no limits.`]

[`Expire date`]

[`Leave empty for no expiration date.`]

[`Link to promo description`]
[`Comment`]

[`Optional comment for your convenience. Will never be shown to customers.`]

{include file="./MarketingCouponsProductSelector.html" hash=$coupon.products_hash types=$product_types sets=$product_sets}
{if $coupon.id} {/if}
{if !empty($coupon.id)} {/if}
{if $coupon.id}

[`Usage`]

{if $orders}

{_w("This coupon was used for %d order.", "This coupon was used for %d orders.", count($orders))}

{foreach $orders as $o} {/foreach} {if $overall_discount>0} {/if}
{$wa->shop->orderId($o.id)} {if $o.coupon_discount_percent > 0}{ifset($o.coupon_discount_formatted)} {$o.coupon_discount_percent}%{else} {/if} {$o.create_datetime|wa_date:"humandate"}

[`Overall discount`]

{$overall_discount_formatted}
{else}

[`This coupon was not used for any orders yet.`]

{/if}
{/if}