File tree Expand file tree Collapse file tree 3 files changed +18
-13
lines changed
Checkout/view/frontend/web/js
Customer/view/frontend/web/js Expand file tree Collapse file tree 3 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -14,17 +14,20 @@ define([
14
14
'use strict' ;
15
15
16
16
var quoteItems = ko . observable ( quote . totals ( ) . items ) ,
17
- cartData = customerData . get ( 'cart' ) ,
18
- quoteSubtotal = parseFloat ( quote . totals ( ) . subtotal ) ,
19
- subtotalAmount = parseFloat ( cartData ( ) . subtotalAmount ) ;
17
+ cartData = customerData . get ( 'cart' ) ;
20
18
21
19
quote . totals . subscribe ( function ( newValue ) {
22
20
quoteItems ( newValue . items ) ;
23
21
} ) ;
24
22
25
- if ( quoteSubtotal !== subtotalAmount ) {
26
- customerData . reload ( [ 'cart' ] , false ) ;
27
- }
23
+ cartData . subscribe ( function ( ) {
24
+ var quoteSubtotal = parseFloat ( quote . totals ( ) . subtotal ) ,
25
+ subtotalAmount = parseFloat ( cartData ( ) . subtotalAmount ) ;
26
+
27
+ if ( quoteSubtotal !== subtotalAmount ) {
28
+ customerData . reload ( [ 'cart' ] , false ) ;
29
+ }
30
+ } , this ) ;
28
31
29
32
return {
30
33
totals : quote . totals ,
Original file line number Diff line number Diff line change @@ -94,17 +94,17 @@ define([
94
94
this . isLoading ( addToCartCalls > 0 ) ;
95
95
sidebarInitialized = false ;
96
96
this . update ( updatedCart ) ;
97
+
98
+ if ( cartData ( ) [ 'website_id' ] !== window . checkout . websiteId ) {
99
+ customerData . reload ( [ 'cart' ] , false ) ;
100
+ }
97
101
initSidebar ( ) ;
98
102
} , this ) ;
99
103
$ ( '[data-block="minicart"]' ) . on ( 'contentLoading' , function ( ) {
100
104
addToCartCalls ++ ;
101
105
self . isLoading ( true ) ;
102
106
} ) ;
103
107
104
- if ( cartData ( ) [ 'website_id' ] !== window . checkout . websiteId ) {
105
- customerData . reload ( [ 'cart' ] , false ) ;
106
- }
107
-
108
108
return this . _super ( ) ;
109
109
} ,
110
110
isLoading : ko . observable ( false ) ,
Original file line number Diff line number Diff line change @@ -232,9 +232,11 @@ define([
232
232
if ( ! _ . isEmpty ( privateContent ) ) {
233
233
countryData = this . get ( 'directory-data' ) ;
234
234
235
- if ( _ . isEmpty ( countryData ( ) ) ) {
236
- customerData . reload ( [ 'directory-data' ] , false ) ;
237
- }
235
+ countryData . subscribe ( function ( ) {
236
+ if ( _ . isEmpty ( countryData ( ) ) ) {
237
+ customerData . reload ( [ 'directory-data' ] , false ) ;
238
+ }
239
+ } , this ) ;
238
240
}
239
241
} ,
240
242
You can’t perform that action at this time.
0 commit comments