plugin updates

This commit is contained in:
Tony Volpe
2024-09-05 11:04:01 -04:00
parent ed6b060261
commit 50cd64dd3d
925 changed files with 16918 additions and 13003 deletions

View File

@@ -66,5 +66,37 @@ jQuery(function( $ ) {
}
};
/**
* Handles warning about coupons using password protection.
*/
const wc_coupon_password_warning = {
init: function() {
const $warning = $( '#wc-password-protected-coupon-warning' );
// Bail out early if necessary.
if ( 0 === $warning.length ) {
return;
}
const $visibility = $( 'input[name="visibility"]' ),
$password_visibility = $( '#visibility-radio-password' ),
$password_label = $( 'label[for="visibility-radio-password"]' );
// For coupons without password, prevent setting it.
if ( ! $password_visibility.is( ':checked' ) ) {
$password_visibility.prop( 'disabled', true );
$password_label.css( 'text-decoration', 'line-through' );
return;
}
$visibility.on(
'change',
function() {
$warning.toggleClass( 'hidden', ! $password_visibility.is( ':checked' ) );
}
);
}
};
wc_meta_boxes_coupon_actions.init();
wc_coupon_password_warning.init();
});