From b8d2f548f3ff51e97b57a320b8f5970d43c9c245 Mon Sep 17 00:00:00 2001 From: Diego Date: Fri, 24 Aug 2018 09:56:20 +0100 Subject: [PATCH] Added triggering of JS events on "recalculate" action on Edit Order page * Ref. https://github.com/woocommerce/woocommerce/issues/21181 --- assets/js/admin/meta-boxes-order.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/assets/js/admin/meta-boxes-order.js b/assets/js/admin/meta-boxes-order.js index f22a3e80638..18bfdce16c2 100644 --- a/assets/js/admin/meta-boxes-order.js +++ b/assets/js/admin/meta-boxes-order.js @@ -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 ); } }); }