Hide restock checkbox until qty is input Closes #6937

This commit is contained in:
Mike Jolley 2015-01-05 17:19:14 +00:00
parent c4812461da
commit 5c86e962e8
3 changed files with 14 additions and 2 deletions

View File

@ -286,6 +286,18 @@ jQuery( function ( $ ) {
}
});
// Restock checkbox
if ( refund_qty > 0 ) {
$( '#restock_refunded_items' ).closest('tr').show();
} else {
$( '#restock_refunded_items' ).closest('tr').hide();
$('.woocommerce_order_items input.refund_order_item_qty').each(function(){
if ( $(this).val() > 0 ) {
$( '#restock_refunded_items' ).closest('tr').show();
}
});
}
$( this ).trigger( 'refund_quantity_changed' );
})
.on( 'change', '.woocommerce_order_items .refund input', function() {

File diff suppressed because one or more lines are too long

View File

@ -250,7 +250,7 @@ if ( wc_tax_enabled() ) {
<?php if ( ( $order->get_total() - $order->get_total_refunded() ) > 0 ) : ?>
<div class="wc-order-data-row wc-order-refund-items" style="display: none;">
<table class="wc-order-totals">
<tr>
<tr style="display:none;">
<td class="label"><label for="restock_refunded_items"><?php _e( 'Restock refunded items', 'woocommerce' ); ?>:</label></td>
<td class="total"><input type="checkbox" id="restock_refunded_items" name="restock_refunded_items" checked="checked" /></td>
</tr>