0 points

opens/closes coupon field


dashboard

Sat May 30 2020 14:20:24 GMT+0000 (UTC)

Posted by @performmarketing #javascript

// Coupon Env
		$( 'div.woocommerce' ).on( 'click', '.coupon-env .coupon-enter', function( ev ) {
			ev.preventDefault();
			
			var $couponEnv = $( this ).parent(),
				$input = $couponEnv.find('.form-control');
			
			$couponEnv.addClass('coupon-visible');

			setTimeout(function(){ $input.focus(); }, 200);
		} ).on( 'click', '.coupon-env .close-coupon', function( ev ) {
			ev.preventDefault();
			
			$( this ).closest( '.coupon-env' ).removeClass('coupon-visible');
		} );
content_copy Copy

This code opens/closed the coupon field. Because the 'apply coupon' button doesn't activate this js, the coupon field remains closed.

https://www.penchantdesign.com/wp-content/themes/aurum/assets/js/aurum-custom.js?ver=2.9.3