mirror of
https://github.com/pronamic/woocommerce-subscriptions.git
synced 2025-10-17 06:42:55 +00:00
26 lines
797 B
JavaScript
Executable File
26 lines
797 B
JavaScript
Executable File
function hide_non_applicable_coupons() {
|
|
var coupon_elements = document.getElementsByClassName( 'cart-discount' );
|
|
|
|
for ( var i = 0; i < coupon_elements.length; i++ ) {
|
|
if ( 0 !== coupon_elements[i].getElementsByClassName( 'wcs-hidden-coupon' ).length ) {
|
|
coupon_elements[i].style.display = 'none';
|
|
}
|
|
}
|
|
}
|
|
|
|
hide_non_applicable_coupons();
|
|
|
|
jQuery( document ).ready( function( $ ) {
|
|
$( document.body ).on( 'updated_cart_totals updated_checkout', function() {
|
|
hide_non_applicable_coupons();
|
|
} );
|
|
|
|
$( '.payment_methods [name="payment_method"]' ).click( function() {
|
|
if ( $( this ).hasClass( 'supports-payment-method-changes' ) ) {
|
|
$( '.update-all-subscriptions-payment-method-wrap' ).show();
|
|
} else {
|
|
$( '.update-all-subscriptions-payment-method-wrap' ).hide();
|
|
}
|
|
} );
|
|
} );
|