• Resolved markiljas

    (@markiljas)


    Hello,

    I’ve noticed that wc-ajax wcpbc_get_location fails to load (incomplete) after 21,86 sec, which takes a big chunk out of the site performance. I was wondering is there a simple way to reduce this, like only to have it load on woocommerce pages. I’ve found that you linked this script in one of the previous posts about this topic (and mentioned this is a replacement “wc-price-based-country-frontend”):

    add_action( ‘wp_print_scripts’, ‘my_deregister_javascript’, 100 );

    function my_deregister_javascript()
    {
    if ( is_page(‘YOUR PAGE NAME’) )
    {
    wp_deregister_script( ‘WORDPRESS JS file NAME’ );
    }
    }

    As I am not sure what exactly should I replace, so wanted to ask for a bit more of an insight – do I need to list every woocommerce page? Or is there a way to refer to all woocommerce pages?

    Or even better, is there a way to fox the fail to load overall? Because I’m afraid the issue would still go on, just on woocommerce pages.

    Thanks!

    EDIT: It doesn’t always fail to load, but it does take longer than usual.

    • This topic was modified 5 years, 3 months ago by markiljas.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter markiljas

    (@markiljas)

    Hello again,

    Just wanted to update that I have managed to reduce the load through tinkering, but would still be interested to know how to make the prices load only on shop pages ??

    Thanks!

    Plugin Author Oscar Gare

    (@oscargare)

    Hi,
    I’m happy you solved the issue with the “wcpbc_get_location” AJAX call.

    About the second question, If you want, you can “deregister” the script ‘wc-price-based-country-frontend’, and use the WooCommerce conditional functions to check if is a WooCommerce page: https://docs.woocommerce.com/document/conditional-tags/

    I hope this helps ??

    Thread Starter markiljas

    (@markiljas)

    Hello,

    Thanks for the suggestion, will look into it!

    However, it seems that the +20 sec load is back, it seems the Heartbeat wasn’t an issue… Any idea what might be causing this?

    Here’s a screenshot of the waterfall from GTmetrix: https://imgur.com/Yt9h16Y

    Thanks!

    Plugin Author Oscar Gare

    (@oscargare)

    Hi!
    In the Pingdom test I’m getting <400ms
    https://ibb.co/Qds3Wbw

    • This reply was modified 5 years, 2 months ago by Oscar Gare.
    Thread Starter markiljas

    (@markiljas)

    Hello,
    Hm, that is odd, it is loading normally now for me as well, but I didn’t change anything. It seems to happen sporadically, but can’t reliably reproduce the error. Will try to implement your suggestion above and also see if the slow load will show up again. If it does and I figure out it happens regularly, I’ll report back, but for now you can mark this solved ??

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Ajax Load’ is closed to new replies.