<{if $webshop->hasLoyaltyProgram() && $customer && $customer->getActivePoints()}> <{* The customer asked for more points than the basket can carry, typically because the basket changed after the points were chosen. This sits OUTSIDE the check below, because there may be 0 points left to use — and the explanation would then vanish. *}> <{if $points_clamped}>

<{if $points_granted}> <{t x=$points_clamped|number_format:0:$webshop->getDecimalSeparator(","):$webshop->getThousandSeparator(".") y=$points_granted|number_format:0:$webshop->getDecimalSeparator(","):$webshop->getThousandSeparator(".")}>Du valgte {x} point, men kurven er ændret siden. Vi bruger {y} point på ordren.<{/t}> <{else}> <{t x=$points_clamped|number_format:0:$webshop->getDecimalSeparator(","):$webshop->getThousandSeparator(".")}>Du valgte {x} point, men de kan ikke bruges på kurvens nuværende indhold.<{/t}> <{/if}>

<{/if}> <{if $customer->getPointsAvailable()}>

<{t x=$customer->getActivePoints()|number_format:0:$webshop->getDecimalSeparator(","):$webshop->getThousandSeparator(".")}>You have {x} points<{/t}>

<{t x=$customer->getPointsAvailable()|number_format:0:$webshop->getDecimalSeparator(","):$webshop->getThousandSeparator(".") y=$webshop->getLoyaltyProgramBaseCost()|number_format:0:$webshop->getDecimalSeparator(","):$webshop->getThousandSeparator(".") z=$webshop->getCurrency()}>You can use {x} points on this order. When you pay with points, {y} points equal 1 {z}.<{/t}>

<{include file="components/label.html" for="use_points" text="Points"|t xclass="{'label--is-floating': use_points && use_points.length > 0 }" }> <{include file="components/input.html" name="use_points" type="text" placeholder="Points"|t inputmode="numeric" autocomplete="off" xclass="{'input--has-value': use_points && use_points.length > 0 }" xmodel="use_points" xvalue="use_points" xref="use_points" }>
<{include file="components/button.html" class="voucher__btn" size="lg" text="Use points"|t type="submit" variant="default"}>
<{if $earns}>

<{t x=$earns|number_format:0:$webshop->getDecimalSeparator(","):$webshop->getThousandSeparator(".")}>You earn {x} points on this order.<{/t}>

<{/if}>
<{/if}> <{/if}>