Skip to content

Commit 6f6ebf0

Browse files
committed
make remove discount a form (it modifies stuff, it should be a post)
1 parent 1e2cb9a commit 6f6ebf0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

templates/checkout/_partials/cart-voucher.tpl

+8-4
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,23 @@
1212
<ul class="cart-voucher__list">
1313
{foreach from=$cart.vouchers.added item=voucher}
1414
<li class="cart-voucher__item row">
15-
<span class="cart-voucher__name col">{$voucher.name}</span>
1615
<div class="d-flex align-items-center justify-content-end col">
16+
<span class="cart-voucher__name col">{$voucher.name}</span>
1717
<span class="fw-bold">{$voucher.reduction_formatted}</span>
1818
{if isset($voucher.code) && $voucher.code !== ''}
19-
<a href="{$voucher.delete_url}" class="ms-2" data-link-action="remove-voucher"><i class="material-icons" title="{l s='Remove Voucher' d='Shop.Theme.Checkout'}">&#xE872;</i></a>
19+
<form action="{$urls.pages.cart}?action=show" data-link-action="remove-voucher" class="d-flex" method="post">
20+
<input type="hidden" name="token" value="{$static_token}">
21+
<input type="hidden" name="deleteDiscount" value="{$voucher.id_cart_rule}">
22+
<button type="submit" class="btn btn-link ms-2"><span><i class="material-icons" title="{l s='Remove Voucher' d='Shop.Theme.Checkout'}">&#xE872;</i></span></button>
23+
</form>
2024
{/if}
2125
</div>
2226
</li>
2327
{/foreach}
2428
</ul>
2529
{/block}
2630
{/if}
27-
31+
2832
<hr />
2933

3034
<div class="accordion">
@@ -36,7 +40,7 @@
3640
<div id="promo-code" class="accordion-collapse collapse">
3741
<div class="accordion-body px-0">
3842
{block name='cart_voucher_form'}
39-
<form action="{$urls.pages.cart}" data-link-action="add-voucher" class="d-flex" method="post">
43+
<form action="{$urls.pages.cart}?action=show" data-link-action="add-voucher" class="d-flex" method="post">
4044
<input type="hidden" name="token" value="{$static_token}">
4145
<input type="hidden" name="addDiscount" value="1">
4246
<input class="form-control" type="text" name="discount_name" placeholder="{l s='Paste your voucher here' d='Shop.Theme.Checkout'}">

0 commit comments

Comments
 (0)