[Resolved] WooCommerce Cart Fragments

Home Forums Support [Resolved] WooCommerce Cart Fragments

Home Forums Support WooCommerce Cart Fragments

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #2192751


    I am running GeneratePress Premium on my website with a WooCommerce store. Today I was in touch with my host (Cloudways) because I received a database error and they figured out it was due to WooCommerce Cart Fragments and directed me to this help doc: https://wpengine.com/support/how-to-disable-cart-fragments-for-woocommerce/

    I wanted to check in for some GeneratePress-specific help on this issue if possible. I found this previous GP support topic: https://generatepress.com/forums/topic/woocommerce-cart-fragments-solution-nothing-seems-to-work/ and am wondering if rather than installing a plugin or editing functions.php to deal with this if it would be enough to follow the outlined steps that David explains, i.e.:

    (From David’s response in the support topic): Things to check for:

    1. Ajax is disabled in Woocommerce > Settings > Products –> Add to cart behaviour
    2. Menu cart is disabled in Customizer > Layout > Woocommerce.
    3. Use the dequeue function with a higher priorty eg.

    add_action( 'wp_enqueue_scripts', 'bbloomer_disable_woocommerce_cart_fragments', 200 ); 
    function bbloomer_disable_woocommerce_cart_fragments() { 
       wp_dequeue_script( 'wc-cart-fragments' ); 

    I would appreciate any suggestions or guidance you can offer and also clarification re: the code above and where to implement it if necessary (would I add this via a code snippet or in the Customize panel?). Thanks so much!

    Customer Support

    Hi there,

    the steps I provided should still work in the latest version of Woo.
    The Snippet of code is PHP, and this doc explains how to add that to your site:


    TLDR: If you’re using a Child Theme, then add the code to the end of the Child Theme functions.php, if you’re not then install the Code Snippets plugin and add the code there.


    Thank you, David. I’ve applied these changes and removed the menu cart for now. Is there any way to maintain the menu cart and still fix this cart fragment issue? My concern is that it might result in a confusing shopping/checkout experience since people might not know where to find their cart as they’re browsing… is there a workaround you’d suggest?

    Thanks again. I know it’s not necessarily a GeneratePress-specific issue, but I want to make sure the fix plays nicely with GP so I really appreciate your help with this.

    Customer Support

    Just an aside, i know wc-cart-fragments can cause performance issues, but i have never heard of it creating database errors so you may want to challenge the host for more info on this.

    But in the meantime heres some options:

    a) of the three actions listed above, only apply #3 ie. adding the snippet, leave the menu cart and ajax on.
    If you still get issues then go to b)

    b) apply #1 and #3 and in Customizer > Layout > Woocommerce disable the Cart Sub Menu.


    Thanks so much. I tried option A and it seemed like it still needed me to disable the Cart Sub Menu (since it started appearing as a plain white drop down box with no content) so I went ahead and tried option B and that seems to be working well. I’ll definitely follow up again with my host about this, thanks for suggesting that and for all your help.

    Customer Support
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.