Support » Plugin: WooCommerce » Cart is not working in the Homepage

  • Resolved mitchelly

    (@mitchelly)


    Hi All,

    Any idea why my cart is not working on the homepage and a few other pages?
    https://shoporama.com.au/

    When I click on the cart or go over it it shows nothing but it says 1, 2, or more items in it.
    Someone told me it is cache but I cleared the Hummingbird Cache and tried it with an incognito window but still the same.
    Any help in a plain language that I can understand is much appreciated. 🙂

    Many thanks in advance
    Mitchell

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support kellymetal

    (@kellymetal)

    Hi there Mitchell,

    Just to confirm, I believe you are referring to the mini-cart in the header menu area. Please let me know if you were referring to something different.

    I see after adding an item to the Cart, the mini-cart shows (1) item, but then doesn’t display any content after hovering over it.

    Generally, the advice that “someone” gave you is true — issues with items not being added to Cart are usually caused by caching. However, just clearing the cache is not enough in this case. It will be necessary to completely exclude the Cart from any caching.

    Please make sure your Cart, Checkout, and My Account pages are all excluded from any caching plugins you have installed on the site. Also, please reach out to your hosting company to make sure those pages are excluded from caching on the server itself as well.

    If you are still having issues though, those mini-carts are usually created/controlled by the active theme on the site. Please reach out to your theme developer to ask about this if it still does not seem to be working.

    I hope that helps!

    mitchelly

    (@mitchelly)

    correct the mini cart on the top right-hand site.

    mitchelly

    (@mitchelly)

    I am using Hummingbird, it says;

    “You can use the define(‘DONOTCACHEPAGE’, true); constant to instruct Hummingbird not to cache specific pages or templates.”

    So where do I add this to disable it on these Cart, Checkout, and My Account pages?
    Where the actual files are and called so I can add the define(‘DONOTCACHEPAGE’, true); to it and anywhere on those pages?

    I added it in the Theme Cart Folders Cart.php file and didn’t work.
    Also I did this in Hummingbirds plugin

    “URL Strings”
    “You can tell Hummingbird not to cache specific URLs, or any URLs that contain strings. Add one entry per line.”

    wp-.*\.php
    index\.php
    xmlrpc\.php
    sitemap.xml
    cart\.php
    checkout\.php
    myaccount\.php
    my-account\.php

    And still no luck

    Thanks

    • This reply was modified 4 months ago by mitchelly.
    • This reply was modified 4 months ago by mitchelly.
    Plugin Support RK

    (@riaanknoetze)

    That’s a question better suited for hummingbird to answer. Speaking in general, it’s typically added to the functions.php file of a child theme or in a plugin like https://wordpress.org/plugins/code-snippets/ although it might need additional tweaking to only target the cart/checkout pages and the mini-cart section.

    mitchelly

    (@mitchelly)

    Thank you however how do I add
    define(‘DONOTCACHEPAGE’, true);
    to the function.php file so it knows that it is for cart and mini cart files?
    How do I make it connected to the cart, because there is no mention of cart or mini cart.
    Thanks
    Mitchell

    Plugin Support RK

    (@riaanknoetze)

    That’s exactly the part where my earlier answer comes into play – the code define(‘DONOTCACHEPAGE’, true); needs to wrapped in conditionals that target specific pages/sections.

    Essentially, additional code is required that only targets (1) the mini-cart section and (2) the pages where the mini-cart is shown. The reason there is no one-size-fit-all-answer is that the theme files that are used for the mini-cart vary from one theme to the next (i.e. it’s not part of the core WooCommerce *plugin* itself – it’s added by the theme).

    Practically this also means that it would need closer scrutiny either by the developers of Hummingbird after logging into your site to look at the code OR by a web developer to add that code.

    Plugin Support m155y5

    (@m155y5)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please feel free to start a new thread.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.