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
|
|
|
|
2016-12-14 11:07:08 +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();
|
2014-08-31 06:25:22 +00:00
|
|
|
});
|