Cache checkout fragments and only update DOM on change
This commit is contained in:
parent
ba517650a1
commit
c3076209c7
|
@ -360,9 +360,12 @@ jQuery( function( $ ) {
|
||||||
// Always update the fragments
|
// Always update the fragments
|
||||||
if ( data && data.fragments ) {
|
if ( data && data.fragments ) {
|
||||||
$.each( data.fragments, function ( key, value ) {
|
$.each( data.fragments, function ( key, value ) {
|
||||||
$( key ).replaceWith( value );
|
if ( ! wc_checkout_form.fragments || wc_checkout_form.fragments[ key ] !== value ) {
|
||||||
|
$( key ).replaceWith( value );
|
||||||
|
}
|
||||||
$( key ).unblock();
|
$( key ).unblock();
|
||||||
} );
|
} );
|
||||||
|
wc_checkout_form.fragments = data.fragments;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recheck the terms and conditions box, if needed
|
// Recheck the terms and conditions box, if needed
|
||||||
|
|
Loading…
Reference in New Issue