• alexla91

    (@alexla91)


    Greetings,
    im new in this forum,
    few days ago i had a problem with the AJAX cart of WooCommerce: when i try to add a product with ajax button, the cart doesn’t refresh automatically (i can’t see product addeded). It’s possible to see product in the cart, only after page refresh. I searched everywhere but i didnt found nothing useful i tried every solution posted in other forums but nothing. Can you help me?
    Thank You.

Viewing 6 replies - 1 through 6 (of 6 total)
  • kursora

    (@kursora)

    1. Check your browser console for JavaScript errors.
    2. Enable WP_DEBUG_LOG and check debug.log file for PHP errors.

    Thread Starter alexla91

    (@alexla91)

    I opened the console and i found this.

    JQMIGRATE: Migrate is installed, version 1.4.1
    autoptimize_9c8491124f32dd1b152bb6f5b216e526.php:432 Uncaught TypeError: a.getElementsByClassName is not a function
    at f.WOW.f.doSync (autoptimize_9c8491124f32dd1b152bb6f5b216e526.php:432)
    at f.<anonymous> (autoptimize_9c8491124f32dd1b152bb6f5b216e526.php:432)
    at MutationObserver.config.live.a.observe.childList (autoptimize_9c8491124f32dd1b152bb6f5b216e526.php:432)
    autoptimize_9c84911….php:432 Uncaught TypeError: a.getElementsByClassName is not a function
    at f.WOW.f.doSync (autoptimize_9c84911….php:432)
    at f.<anonymous> (autoptimize_9c84911….php:432)
    at MutationObserver.config.live.a.observe.childList (autoptimize_9c84911….php:432)
    WOW.f.doSync @ autoptimize_9c84911….php:432
    (anonymous) @ autoptimize_9c84911….php:432
    config.live.a.observe.childList @ autoptimize_9c84911….php:432

    For PHP errors there is an error from the slider but i dont think that affect the cart.

    autoptimize is a type of cache? The cart page should be excluded from caching:
    https://docs.woocommerce.com/document/configuring-caching-plugins/

    Optimizing Matters

    (@optimizingmatters)

    fyi: there’s an option in Autoptimize (which does not do page caching, just JS/ CSS optimization) to enable/ disable it on the cart/ checkout page.

    frank (ao dev)

    Thread Starter alexla91

    (@alexla91)

    Done yet but it didn’t work, same thing as before.

    Optimizing Matters

    (@optimizingmatters)

    if the ajax cart is accessed outside of the actual cart-page, then disabling AO on the checkout/ cart page will not help.

    you’ll instead have to tweak AO to exclude relevant files from JS optimization (cfr. AO FAQ for general info on how to troubleshoot & exclude JS from autoptimization). based on the console error, you would want to start by trying to exclude wow.js or wow.min.js or wow-min.js or something similar (as that seems to be breaking the JS exectution in this case)

    frank

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Problems with AJAX cart’ is closed to new replies.