From 247fd3f610521a278636a6925965c6e231216e7c Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 3 Jan 2019 13:37:32 +0000 Subject: [PATCH] Update notes with response --- assets/js/admin/meta-boxes-order.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/assets/js/admin/meta-boxes-order.js b/assets/js/admin/meta-boxes-order.js index a8424790cf6..6cd18357129 100644 --- a/assets/js/admin/meta-boxes-order.js +++ b/assets/js/admin/meta-boxes-order.js @@ -687,10 +687,22 @@ jQuery( function ( $ ) { data: data, type: 'POST', success: function( response ) { - $( '#woocommerce-order-items' ).find( '.inside' ).empty(); - $( '#woocommerce-order-items' ).find( '.inside' ).append( response ); - wc_meta_boxes_order_items.reloaded_items(); - wc_meta_boxes_order_items.unblock(); + if ( response.success ) { + $( '#woocommerce-order-items' ).find( '.inside' ).empty(); + $( '#woocommerce-order-items' ).find( '.inside' ).append( response.data.html ); + + // Update notes. + if ( response.data.notes_html ) { + $( 'ul.order_notes' ).empty(); + $( 'ul.order_notes' ).append( $( response.data.notes_html ).find( 'li' ) ); + } + + wc_meta_boxes_order_items.reloaded_items(); + wc_meta_boxes_order_items.unblock(); + } else { + wc_meta_boxes_order_items.unblock(); + window.alert( response.data.error ); + } } });