Added triggering of JS events on "recalculate" action on Edit Order page

* Ref. https://github.com/woocommerce/woocommerce/issues/21181
This commit is contained in:
Diego 2018-08-24 09:56:20 +01:00
parent d5e229f98a
commit b8d2f548f3
1 changed files with 7 additions and 0 deletions

View File

@ -641,6 +641,8 @@ jQuery( function ( $ ) {
items: $( 'table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]' ).serialize(),
security: woocommerce_admin_meta_boxes.calc_totals_nonce
} );
$( document.body ).trigger( 'order-totals-recalculate-before', data );
$.ajax({
url: woocommerce_admin_meta_boxes.ajax_url,
@ -651,6 +653,11 @@ jQuery( function ( $ ) {
$( '#woocommerce-order-items' ).find( '.inside' ).append( response );
wc_meta_boxes_order_items.reloaded_items();
wc_meta_boxes_order_items.unblock();
$( document.body ).trigger( 'order-totals-recalculate-success', response );
},
complete: function( response ) {
$( document.body ).trigger( 'order-totals-recalculate-complete', response );
}
});
}