Cache checkout fragments and only update DOM on change

This commit is contained in:
Paul Dechov 2019-07-24 18:00:29 -04:00
parent ba517650a1
commit c3076209c7
1 changed files with 4 additions and 1 deletions

View File

@ -360,9 +360,12 @@ jQuery( function( $ ) {
// Always update the fragments
if ( data && data.fragments ) {
$.each( data.fragments, function ( key, value ) {
if ( ! wc_checkout_form.fragments || wc_checkout_form.fragments[ key ] !== value ) {
$( key ).replaceWith( value );
}
$( key ).unblock();
} );
wc_checkout_form.fragments = data.fragments;
}
// Recheck the terms and conditions box, if needed