| 1 |
/** |
| 2 |
* Checkout Coupon widget: open the coupon form when the notice banner is tapped. |
| 3 |
* |
| 4 |
* WooCommerce only binds a.showcoupon. On narrow viewports the link wraps, so |
| 5 |
* most of the banner's hit area is the parent div and the form stays closed. |
| 6 |
*/ |
| 7 |
(function ($) { |
| 8 |
'use strict'; |
| 9 |
|
| 10 |
$(document).on('click', '.ka-woo-checkout-coupon .woocommerce-form-coupon-toggle', function (event) { |
| 11 |
if (event.target.closest('a.showcoupon')) { |
| 12 |
return; |
| 13 |
} |
| 14 |
const link = this.querySelector('a.showcoupon'); |
| 15 |
if (!link) { |
| 16 |
return; |
| 17 |
} |
| 18 |
event.preventDefault(); |
| 19 |
link.click(); |
| 20 |
}); |
| 21 |
})(jQuery); |
| 22 |
|