Merge pull request #22629 from woocommerce/performance/22260

Use `get` instead of `load` on cart page
This commit is contained in:
Gerhard Potgieter 2019-02-06 15:47:17 +02:00 committed by GitHub
commit d0898e6a80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -119,15 +119,13 @@ jQuery( function( $ ) {
AddToCartHandler.prototype.updateCartPage = function() {
var page = window.location.toString().replace( 'add-to-cart', 'added-to-cart' );
$( '.shop_table.cart' ).load( page + ' .shop_table.cart:eq(0) > *', function() {
$( '.shop_table.cart' ).stop( true ).css( 'opacity', '1' ).unblock();
$.get( page, function( data ) {
$( '.shop_table.cart:eq(0)' ).replaceWith( $( data ).find( '.shop_table.cart:eq(0)' ) );
$( '.cart_totals:eq(0)' ).replaceWith( $( data ).find( '.cart_totals:eq(0)' ) );
$( '.cart_totals, .shop_table.cart' ).stop( true ).css( 'opacity', '1' ).unblock();
$( document.body ).trigger( 'cart_page_refreshed' );
});
$( '.cart_totals' ).load( page + ' .cart_totals:eq(0) > *', function() {
$( '.cart_totals' ).stop( true ).css( 'opacity', '1' ).unblock();
$( document.body ).trigger( 'cart_totals_refreshed' );
});
} );
};
/**