Replies: 2 comments 1 reply
-
Of course, this sounds good. Every improvement is highly appreciated here!
I think removing the Subtotal is not a good idea, because since v6 stable there is no cart page anymore. |
Beta Was this translation helpful? Give feedback.
-
I think I have not explained that clearly enough :) I just want to remove the display of the cart total from the header (which is only shown on desktop now anyways) to make the action button static. The count badge will then be applied via ajax dynamically when the cart is loaded. I wouldn't change anything in the mini-cart contents. Just the init would be via ajax only and therefore also speed up the page load of non cached sites :) |
Beta Was this translation helpful? Give feedback.
-
I have done that in some previous projects and as I have to adapt the template again I thought maybe there is interest to adapt the current solution via some filters.
In order to make the whole html response cacheable, we would need to exclude all dynamic data (cart value, cart items, and sidecart content). As the content is already refreshed directly after the pageload via ajax, it is enough to "just" remove some calls.
Changes in the experience:
If you would like to prevent flickering (Pagespeed CLS) I would remove the display of the total sum (€ 100,00) that actually is in the cart as well because the counter of the cart is an absolute positioned overlay anyways.
Improvements:
Faster Pageload on all cart enabled pages
Cacheable headers
No Flickering of the cart on pageload
Basically what has to be done:
On Pageload the woocommerce cart Icon is rendered via template-parts/header/actions-woocommerce.php and the sidecart as well via template-parts/header/offcanvas-woocommerce.php. All dynamic stuff would be excluded there and is already loaded directly after pageload anyways. Additionally we would have to remove 1 line in the ajax-cart.php that updates the cart value on change.
If there is interest, I would prepare a PR as a suggestion.
Another step to make the page completely cacheable would be to make the content of the Offcanvas user also callable via ajax. Then the complete HTML Response can be cached and the speed Improvements can be great. So far I have some ideas to solve that but if anyone else wants to join on that part I would be quite happy :D
DISCLAIMER: I have to add, that caching on ecommerce homepages is something extremely powerful but also can be quite tedious because of dynamic areas, so I would only enable those features behind a flag/filter to make it an option for those who care.
Beta Was this translation helpful? Give feedback.
All reactions