-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Remove the global wc-cart-fragments enqueue #35530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test Results SummaryCommit SHA: 32bd197
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
|
Hi @Konamiman, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
|
Ill go ahead and merge this before the feature freeze. The following note can be included with the release:
|
|
Isn't it a breaking change? In my theme the code |
All Submissions:
Changes proposed in this Pull Request:
wc-cart-fragmentsallows statically rendered elements to be updated when a product is added to the cart. It does this with an additional AJAX call to theget_refreshed_fragmentsendpoint. This does create a performance issue where extra requests are made to the server to support it.There are several articles on the web detailing how this is a problem and recommending to dequeue it [1], as well as workarounds which replace the functionality entirely [2].
Given that the main consumer of this functionality is the Cart Widget, and that the Cart Widget is being superseded by the Mini Cart Block, I propose we remove this from the global enqueues and move it to the Cart Widget only, so the widget can continue to use fragments, but other pages in the store do not need to load the script.
This was proposed here: woocommerce/woocommerce-blocks#7168
We plan on removing support for fragments in WooCommerce Blocks, and potentially dequeuing it completely in the interim.
[1] https://wpengine.com/support/how-to-disable-cart-fragments-for-woocommerce/
[2] https://wpengine.com/blog/solving-cart-fragment-dilemma-introducing-live-cart/
This PR is a very minor change/addition and does not require testing instructions (if checked you can ignore/remove the next section).
How to test the changes in this Pull Request:
cart-fragments.jsscript is not loaded.cart-fragments.jsscript is loaded.Other information:
pnpm --filter=<project> changelog add?FOR PR REVIEWER ONLY: