Comments (4)
The Cart Fragments script, responsible for updating the cart widget after a successful add-to-cart event, can cause a performance issue on stores not making use of that functionality. To mitigate this, the script will now only be enqueued if using the Mini Cart widget.
This change was implemented with WooCommerce 7.8 here: woocommerce/woocommerce#35530
And, this issue is a result of that.
Stores that are not using the widget can re-enable this functionality by either adding the widget to one of their widget areas/sidebars or by enqueuing the script manually:
function enqueue_wc_cart_fragments() { wp_enqueue_script( 'wc-cart-fragments' ); }
add_action( 'wp_enqueue_scripts', 'enqueue_wc_cart_fragments' );
If you’re looking for an alternative to the Mini Cart widget that does not suffer from the performance issue, try the Mini Cart Block instead.
More details about this change below:
- https://developer.woocommerce.com/2023/05/24/woocommerce-7-8-beta-1-released/
https://developer.woocommerce.com/2023/06/16/best-practices-for-the-use-of-the-cart-fragments-api/ - Should you have any further questions, please let me know. We are here to help!
from storefront.
Hi there @druesome ! Thanks for reaching out to us. I can confirm this issue occurs on the latest version of Storefront running alongside both WooCommerce 7.8.0 and 7.9.0.
I'm moving this issue to our backlog: it will be updated as soon as we start working on a solution.
from storefront.
@thisissandip Thank you for chiming in! While there may be some workarounds, they seem to be temporary solutions rather than address the specific problem with the Storefront theme. Unlike other themes, Storefront automatically includes the cart icon in the header. Therefore, adding the Mini Cart widget or block would seem redundant in this scenario.
The code you shared, however, works:
function enqueue_wc_cart_fragments() { wp_enqueue_script( 'wc-cart-fragments' ); }
add_action( 'wp_enqueue_scripts', 'enqueue_wc_cart_fragments' );
Would it make sense to just package this into the Storefront theme? Or, if that isn't possible, just remove the cart icon from the Storefront theme header altogether?
Also, do you know why adding products from the shop page or product category pages updates the numbers correctly, but not from the cart page?
from storefront.
Duplicate of #2101
from storefront.
Related Issues (20)
- JS files are not being minified on build HOT 5
- #2113 breaks refreshing the cart on non-WC cached pages HOT 4
- Hand-picked Products: On Sale Bade - wrong position
- A deprecated notice appears on the admin and front end with WP 6.3 HOT 1
- Remove max-width on image div for Mix and Match Products extension
- Fractional product quantity shown as 0 HOT 1
- Incorrect breakpoint padding/margin-right on Gutenberg
- Error implementing elementor checkout widget in storefront
- Measurement price calculator duplicate fields HOT 1
- Icon of new notices are not visible for certain actions HOT 3
- Incorrect link in readme.md HOT 1
- storefront Mini Cart count and wc is not updating properly HOT 1
- How to show more than 3 categories on the homepage template?
- Jetpack Site logo being deprecated in Jetpack 13.4
- HandHeld Menu doesn't work HOT 3
- 4.5.6 release does not include minified JS files (regression from 4.5.5 release) HOT 5
- My Account – tab “Orders”, Mobile version HOT 14
- Theme accessibility HOT 1
- Changed files missing from last two commits. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storefront.