woocommerce/assets/js/admin/meta-boxes-coupon.js

34 lines
597 B
JavaScript
Raw Normal View History

2015-07-10 04:32:30 +00:00
jQuery(function( $ ) {
2014-07-08 13:14:29 +00:00
2015-07-10 04:32:30 +00:00
/**
* Coupon actions
*/
var wc_meta_boxes_coupon_actions = {
2014-07-08 13:14:29 +00:00
2015-07-10 04:32:30 +00:00
/**
* Initialize variations actions
*/
init: function() {
$( 'select#discount_type' )
.on( 'change', this.type_options )
.change();
},
2014-07-08 13:14:29 +00:00
2015-07-10 04:32:30 +00:00
/**
* Show/hide fields by coupon type options
*/
type_options: function() {
// Get value
var select_val = $( this ).val();
2014-07-08 13:14:29 +00:00
if ( select_val !== 'fixed_cart' ) {
2015-07-10 04:32:30 +00:00
$( '.limit_usage_to_x_items_field' ).show();
} else {
$( '.limit_usage_to_x_items_field' ).hide();
}
}
};
2014-07-08 13:14:29 +00:00
2015-07-10 04:32:30 +00:00
wc_meta_boxes_coupon_actions.init();
});