GithubHelp home page GithubHelp logo

Comments (4)

thisissandip avatar thisissandip commented on July 28, 2024 1

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:

from storefront.

nefeline avatar nefeline commented on July 28, 2024 1

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.

druesome avatar druesome commented on July 28, 2024

@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.

gigitux avatar gigitux commented on July 28, 2024

Duplicate of #2101

from storefront.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.