AJAX cart values bug, Caching, AJAX, etc.

This topic has 6 replies, 2 voices, and was last updated 7 years, 6 months ago ago by Olga Barlow

  • Avatar: RR123
    RR123
    Participant
    October 18, 2016 at 10:39

    Hello,

    The cart does the show the wrong cart value for 500-1500ms, before the AJAX then kicks in and changes the cart value to the correct one for that user. It does look very dangerous for customers to see the cart total jump up and down when browsing from page to page and will put off customers greatly….

    There is very major problem, but simple though so will have been easy to miss. Can this be fixed ASAP?

    I checked this with you guys before starting and I think it is nearly ok, but it needs an important tweak. We had chatted about our hosting provider saying that we can only use templates that use AJAX to show the cart or there will be caching issues that will show the price of a completely different users cart(!). This seems to be a normal point with any decent WP hoster so the template really needs to account for that to be usable.

    Many thanks,

    Richard

    Please, contact administrator
    for this information.
    5 Answers
    Avatar: RR123
    RR123
    Participant
    October 18, 2016 at 10:42

    My thinking if it helps:

    I guess the CSS needs to make it display:none until the AJAX kicks in (easy enough to DIY here), but the important problem that stops us from this DIY fix is that the AJAX would need to make it display:visible right after updating the value…

    Avatar: RR123
    RR123
    Participant
    October 18, 2016 at 10:46

    I should also add that the prob is not always there. I guess it will completely depend on what is being cached by the WP server and then in the browser in that particular moment.

    I can be sure that it is definitely happening because 1) in one woocommerce guest session there was a £x total and 2) another woocommerce guest session running in incognito mode flashed up the other session’s £x total briefly before the AJAX showed the correct £y total.

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    October 20, 2016 at 16:21

    Hello,

    Unfortunately, this is how ajax refresh works. You can enable even official WooCommerce theme – Storefront and check. You’ll see the same situation.

    Regards

    Avatar: RR123
    RR123
    Participant
    October 20, 2016 at 17:40

    I might have fixed it with the below CSS…. not really tested this properly though but it seems to work like a failsafe mechanism.

    It’s just a quick hack to fade in the element, which from what I can see never get’s a change anyway because the AJAX is faster. The AJAX seems to trigger way before this fadein is relevant and make the cart total properly visible when the AJAX is ready.

    Again, it’s just a quick hack, I think…….

    /* fadein cart widget total to get rid of server caching vs ajax problem */
    .shopping-cart-widget .shop-text .amount{
        -webkit-transition: opacity 20s 10s ease;
        -moz-transition: opacity 20s 10s ease;
        -ms-transition: opacity 20s 10s ease;
        -o-transition: opacity 20s 10s ease;
        transition: opacity 20s 10s ease;
     }
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    October 21, 2016 at 15:33

    Hello,

    Yes, it can be used as a quick hack.

    Regards

  • Viewing 6 results - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.