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.
52 lines
2.3 KiB
52 lines
2.3 KiB
<?php
|
|
|
|
/* TO_DO: вынести в twig верстку */
|
|
|
|
/**
|
|
* Checkout coupon form
|
|
*
|
|
* This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-coupon.php.
|
|
*
|
|
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
|
* (the theme developer) will need to copy the new files to your theme to
|
|
* maintain compatibility. We try to do this as little as possible, but it does
|
|
* happen. When this occurs the version of the template file will be bumped and
|
|
* the readme will list any important changes.
|
|
*
|
|
* @see https://woocommerce.com/document/template-structure/
|
|
* @package WooCommerce\Templates
|
|
* @version 7.0.1
|
|
*/
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
if ( ! wc_coupons_enabled() ) { // @codingStandardsIgnoreLine.
|
|
return;
|
|
}
|
|
|
|
?>
|
|
|
|
<?php
|
|
|
|
$applied_coupons = WC()->cart->get_applied_coupons();
|
|
if($applied_coupons){
|
|
$first_coupon = $applied_coupons[0];
|
|
$cText = pll__('Применен промокод:') . $first_coupon;
|
|
$coupon = $applied_coupons[0];
|
|
}
|
|
else{
|
|
$cText = '';
|
|
$coupon = '';
|
|
}
|
|
|
|
?>
|
|
<div action="" class="order-your__promo" id="promo_form" <?php if ( !empty( $applied_coupons ) ) { echo 'style="display: none;"'; } ?>>
|
|
<input type="text" name="coupon_code" class="form__input form__input--grey" placeholder="<?php pll_e('Промокод') ?>" id="coupon_code" value="" />
|
|
<button type="button" class="button button--white button--red-48-px active order-your-promo__button" name="apply_coupon" value="<?php pll_e('Применить') ?>"><?php pll_e('Применить') ?></button>
|
|
<span class="form-input__error form-input__error--absolute" id="promo_err"><?php pll_e('Ошибка! Промокод введен неверно или не существует.') ?></span>
|
|
</div>
|
|
|
|
<div action="" class="order-your__promo" id="promo_delete" <?php if ( empty( $applied_coupons ) ) { echo 'style="display: none;"'; } ?>>
|
|
<input type="text" name="coupon_code_applied" readonly class="form__input form__input--grey" placeholder="Промокод" id="coupon_code_app" value="<?php echo $cText; ?>" />
|
|
<button type="button" class="button button--white button--red-48-px active order-your-promo__button" id="delete_coupon" value="<?php pll_e('Применить') ?>" data-coupon="<?php echo $coupon; ?>"><?php pll_e('Удалить') ?></button>
|
|
</div>
|