You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.8 KiB
39 lines
1.8 KiB
{% if fn('wc_coupons_enabled') %}
|
|
|
|
{# TO_DO перенести в компоненты модуля форм #}
|
|
{% set applied_coupons = fn('WC').cart.get_applied_coupons %}
|
|
{% set has_coupon = applied_coupons is not empty %}
|
|
{% set first_coupon = has_coupon ? applied_coupons[0] : '' %}
|
|
{% set cText = has_coupon ? ('Применен промокод: ' ~ first_coupon) : '' %}
|
|
|
|
<div class="order-your__promo" id="promo_form" {% if has_coupon %}style="display: none;"{% endif %}>
|
|
<input type="text" name="coupon_code" class="form__input form__input--grey" placeholder="Промокод" id="coupon_code" value="" />
|
|
<button type="button"
|
|
class="button button--white button--red-48-px active order-your-promo__button"
|
|
name="apply_coupon"
|
|
value="Применить">
|
|
Применить
|
|
</button>
|
|
<span class="form-input__error form-input__error--absolute" id="promo_err">
|
|
Ошибка! Промокод введен неверно или не существует.
|
|
</span>
|
|
</div>
|
|
|
|
<div class="order-your__promo" id="promo_delete" {% if not has_coupon %}style="display: none;"{% endif %}>
|
|
<input type="text"
|
|
name="coupon_code_applied"
|
|
readonly
|
|
class="form__input form__input--grey"
|
|
placeholder="Промокод"
|
|
id="coupon_code_app"
|
|
value="{{ cText }}" />
|
|
<button type="button"
|
|
class="button button--white button--red-48-px active order-your-promo__button"
|
|
id="delete_coupon"
|
|
value="Применить"
|
|
data-coupon="{{ first_coupon }}">
|
|
Удалить
|
|
</button>
|
|
</div>
|
|
|
|
{% endif %}
|
|
|