meta-boxes-coupon.js 597 B

123456789101112131415161718192021222324252627282930313233
  1. jQuery(function( $ ) {
  2. /**
  3. * Coupon actions
  4. */
  5. var wc_meta_boxes_coupon_actions = {
  6. /**
  7. * Initialize variations actions
  8. */
  9. init: function() {
  10. $( 'select#discount_type' )
  11. .on( 'change', this.type_options )
  12. .change();
  13. },
  14. /**
  15. * Show/hide fields by coupon type options
  16. */
  17. type_options: function() {
  18. // Get value
  19. var select_val = $( this ).val();
  20. if ( select_val !== 'fixed_cart' ) {
  21. $( '.limit_usage_to_x_items_field' ).show();
  22. } else {
  23. $( '.limit_usage_to_x_items_field' ).hide();
  24. }
  25. }
  26. };
  27. wc_meta_boxes_coupon_actions.init();
  28. });