November 13, 2014 at 11:34 pm
Hi,
I’d really like to use the browser cache for html files because this speeds up the website significantly. I would like to use w3 total cache for this.
What stops me is a problem with the amount number in the cart widget (.kad-cart-total .cart-contents .amount). This problem is also notable on the virtue premium demo shop
1. User visits page: Retrieved shopping cart widget is preloaded with a false amount that comes from a another user’s cached html file.
2. … Other things happen until document is ready …
3. WooCommerce starts an ajax request get get right amount number
4. After ajax is loaded the amount widget gets updated.
Between 1. and 4. there is about 1 sec, sometimes more. Due to the flipping of the “wrong” text amount to the right number, it is visually also notable to users that the cart widget changed. That is, it gets noticed.
I would like to do the following to solve this (I am open to other suggestions):
At first:
0. By default, have the cart amount set to visibility: hidden.
4. At step 4, set the cart amount to the visibility: visible
My question is:
1. Are there any caveats I might overlook? E.g. are there situations when step 4 is not executed?
2. Is there a JavaScript event for step 4? I’d need an JS event to subscribe for when the amount has been successfully updated so that the visibility can be set to visible