Order change/keyup price function
on change then keyup for each item. OCD issues
This commit is contained in:
parent
d37f191833
commit
b2d33f00e8
|
@ -73,6 +73,23 @@ jQuery( function ( $ ) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
.on( 'change', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
||||||
|
var sale_price_field = $( this ), regular_price_field;
|
||||||
|
|
||||||
|
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
||||||
|
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
||||||
|
} else {
|
||||||
|
regular_price_field = $( '#_regular_price' );
|
||||||
|
}
|
||||||
|
|
||||||
|
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||||
|
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
||||||
|
|
||||||
|
if ( sale_price >= regular_price ) {
|
||||||
|
$( this ).val( '' );
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
.on( 'keyup', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
.on( 'keyup', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
||||||
var sale_price_field = $( this ), regular_price_field;
|
var sale_price_field = $( this ), regular_price_field;
|
||||||
|
|
||||||
|
@ -92,23 +109,6 @@ jQuery( function ( $ ) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.on( 'change', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
|
||||||
var sale_price_field = $( this ), regular_price_field;
|
|
||||||
|
|
||||||
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
|
||||||
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
|
||||||
} else {
|
|
||||||
regular_price_field = $( '#_regular_price' );
|
|
||||||
}
|
|
||||||
|
|
||||||
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
|
||||||
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
|
||||||
|
|
||||||
if ( sale_price >= regular_price ) {
|
|
||||||
$( this ).val( '' );
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
.on( 'change', '.wc-order-totals #refund_amount[type=text]', function() {
|
.on( 'change', '.wc-order-totals #refund_amount[type=text]', function() {
|
||||||
var regex;
|
var regex;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue