Support » Plugin: WC-AC Hook » Slow checkout

  • Resolved atman1


    Your plugin (or AC server) extends the last checkout step to 15 seconds.
    We did analize the issue and it seems that AC servers respond very slowly and woo doesn’t go to the next step (payment) untill it gets a response from AC.

    So many of my customers thing that the purchas process just froze and leve the store.

    The delay is 15-20 seconds so it’s horrible.

    Is there anything that can be done? Some catching or asynchroneus loading?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author mtreherne


    That’s not good. I’ve not come across anything like that before.

    I will have a look at the ActiveCampaign API and how the calls are made.

    In the meantime, could you do something for me. Confirm the WordPress and WooCommerce versions that you are using.

    Can you also let me know if there was any error recorded in the log (assuming Debug Log is enabled):

    WooCommerce > System Status > Logs > wc-ac-hook*

    Or did it always work – if they waited – but just took a long time?

    Thanks for your patience.

    Newest WordPress 4.4.2 – confirmed
    Newest WooCommerce 2.5.3 – confirmed

    No errors found in logs (despite 2 errors from invalid email adresses given by customers in registration form).

    Thank you very much for your interest.

    Plugin Author mtreherne


    I’ve taken a look through the plugin code to refresh myself, and there are two things I would like to do.

    Firstly, I would like to test with some logging to track down the problem API call. I don’t know whether you will be able to do this, but it will obviously speed things up if you can. If you have a test environment great. Otherwise you will have to enable the plugin again, at least for while, to capture a few contact syncs (I presume you have disabled the plugin at the moment).

    To do the test, I have created a new version of the plugin (1.2.2) with one file updated. This is not a public release (you won’t get notified to install from wp-admin), so you must install using whichever method suits you i.e. FTP or your site control panel or SSH or SVN.

    The plugin can be found at

    There is only one file that actually needs to be updated from version 1.2.1 (you can simply download this, save your old version and replace).

    The file should replace the one in wp-content/plugins/wc-ac-hook/includes

    The changes to the code are simply adding logging (to the debug log) to capture the time (in milliseconds) for each API call. There are four API calls for each contact sync. When I did the test last night I was getting 0.3 to 1.3 ms for each call.

    The second thing I will do is to get in touch with the ActiveCampaign API developers through their forum. I have been through their code and they do not appear to use any options to control the curl connection or execution timeout. So there is no option to control the timeout simply through a parameter (i.e. it would require developing their code). So I will ask them if they have had any similar experiences (API calls taking many minutes), and whether there is a better option to fail gracefully after a configurable timeout period.

    sync-contact.php replaced.

    I will get back to you in few days with results from logs.

    Here are few last logs from today:

    Please tell me what they mean. Was my programmer wrong about the reason of long checkout loading?

    03-13-2016 @ 11:29:25 – Order ID = 11751 (Status = on-hold). [API call: credentials_test = 0.7 ms] [API call: contact/view = 0.71 ms] [API call: contact/sync = 0.8 ms] Contact synced successfully (ActiveCampaign ID = 12126) [API call: contact/tag_remove = 1.34 ms]

    03-13-2016 @ 13:38:10 – Order ID = 11753 (Status = pending). [API call: credentials_test = 1.08 ms] [API call: contact/view = 0.7 ms] [API call: contact/sync = 1.24 ms] Contact synced successfully (ActiveCampaign ID = 12133) [API call: contact/tag_remove = 1.4 ms]

    03-13-2016 @ 13:38:15 – Order ID = 11753 (Status = on-hold). [API call: credentials_test = 0.7 ms] [API call: contact/view = 0.7 ms] [API call: contact/sync = 0.81 ms] Contact synced successfully (ActiveCampaign ID = 12133) [API call: contact/tag_remove = 1.46 ms]

    03-13-2016 @ 13:40:13 – Order ID = 11754 (Status = pending). [API call: credentials_test = 0.77 ms] [API call: contact/view = 0.73 ms] [API call: contact/sync = 0.81 ms] Contact synced successfully (ActiveCampaign ID = 12133) [API call: contact/tag_remove = 1.38 ms]

    03-13-2016 @ 13:40:18 – Order ID = 11754 (Status = on-hold). [API call: credentials_test = 0.69 ms] [API call: contact/view = 0.74 ms] [API call: contact/sync = 0.86 ms] Contact synced successfully (ActiveCampaign ID = 12133) [API call: contact/tag_remove = 1.45 ms]

    03-13-2016 @ 13:44:10 – Order ID = 11754 (Status = completed). [API call: credentials_test = 0.72 ms] [API call: contact/view = 0.77 ms] [API call: contact/sync = 0.85 ms] Contact synced successfully (ActiveCampaign ID = 12133) [API call: contact/tag_remove = 1.31 ms]

    03-13-2016 @ 14:14:45 – Order ID = 11756 (Status = pending). [API call: credentials_test = 0.78 ms] [API call: contact/view = 0.94 ms] [API call: contact/sync = 0.97 ms] Contact synced successfully (ActiveCampaign ID = 3125) [API call: contact/tag_remove = 1.17 ms]

    03-13-2016 @ 14:14:50 – Order ID = 11756 (Status = on-hold). [API call: credentials_test = 0.7 ms] [API call: contact/view = 0.88 ms] [API call: contact/sync = 0.91 ms] Contact synced successfully (ActiveCampaign ID = 3125) [API call: contact/tag_remove = 1.31 ms]

    Plugin Author mtreherne


    Thanks for the logs. They all look fine with fairly consistent timings and all what you would expect.

    Well until we get to the bottom of it, it’s best to keep an open mind, as to what the problem is.

    I would suggest leaving this version running so it carries on logging the times. If this is a fault with ActiveCampaign taking too long to respond, it is likely to be an intermittent problem. So it might take some time to see a problem in the logs.

    I would certainly get back to your programmer and ask him to do the testing again, and share more details of the results with me, to see if there is anything else I can investigate.


    I sent this discussion to my programmer and he gave me more details about his analysis.

    My translation from Polish:

    “Those milisecs is probably the time of internal API functions, after it is connected to the server.

    Our tests look like this:

    start 0 sek
    before api 0 sek
    after api sync 3 sek
    end api 4 sek
    Order ID = 11785 (Status = on-hold). [API call: credentials_test = 0.7 ms] [API call: contact/view = 0.72 ms] [API call: contact/sync = 0.81 ms] Contact synced successfully (ActiveCampaign ID = 12185) [API call: contact/tag_remove = 1.3 ms]
    start 5 sek
    before api 5 sek
    after api sync 7 sek
    end api 8 sek

    The function in which we measured the time: function order_status_change

    Order function is called twice. First it starts at 0 sec, the end of the second is on the 8th second. Whole process took 8 seconds.”

    @mtreherne: Can you make some conclusion now? What can be done to shorten the load time?

    Plugin Author mtreherne


    Hi there,

    No I can’t draw many conclusions yet. In fact it is back to the drawing board. Please can you read through the following and pass onto your programmer, to get his thoughts. I have a couple of questions at the bottom as well.

    Firstly, let me run through an overview how the wc-ac-hook code flows, just to get us on the same page. So that you can understand my thinking with respect to diagnosing the problem.

    There are two woocommerce hooks that trigger action (i.e. trigger calls to the wc-ac-hook).

    woocommerce_order_status_changed (everytime the status of an order is changed)
    woocommerce_checkout_update_order_meta (everytime a new order is created)

    When either of the above happens the wc-ac-hook is triggered and goes through the following steps:

    1. Retrieves and validates order details
    2. Retrieves meta data for each product on order
    3. Instantiates ActiveCampaign class and does AC API credentials_test
    4. Syncs contact (2 api calls using AC API contact/view & contact/sync)
    5. Removes tags (1 api call using AC API contact/tag_remove)
    6. Calls WC_Logger for debug log

    Currently I have setup timing of steps 3, 4 and 5 (i.e. the four API calls).

    I could add an overall time from steps 1-5 (we’ll have to assume that writing to the debug logs is not the problem). It is simple to do this. I suspect this will tell us nothing new (but you never know).

    Just to explain a little more about the four API calls. This is when your server connects to the ActiveCampaign server. Now the way wc-ac-hook works is that it uses a wrapper provided by ActiveCampaign to make the API calls (it saves time using their code and makes sure that it is done right). For your programmer you can see the code for this in the wp-content/plugins/wc-ac-hook/activecampaign-api-php/includes. The Connector.class.php contains the all important curl calls which actually do the HTTP requests between the servers.

    Each API call will create a new curl connection (i.e. go through curl_init, curl_setupt, curl_exec, curl_close). The timings I have given are for doing all this. It is not an asynchronous activity (like AJAX). The HTTP requests are made to ActiveCampaign and the code waits for a response. So the timings I have are the time it took to make the call to ActiveCampaign. So I hate to disagree with your programmer, but I do believe those timings are for the API calls (and not internal).

    So were do I think we are?

    1. On the evidence so far, I have not seen any problems with the response of the ActiveCampaign servers i.e. intermittent delays in connection or response. That does not mean there is not a problem with the plugin, just that it may not be the actual AC API calls that are causing the delay.
    2. I can extend the timings from steps 3-5 to include steps 1&2 so that we log the total time that your server spent in the wc-ac-hook code (apart from the final logging of the data).
    3. Can you confirm that the 8 seconds happens every time? And by every time that includes do you get this when you manually update the status of an order? The good news is that if your programmer is saying the delay always happens then a) it probably isn’t a problem with ActiveCamapaign server response times, and b) since it can be reproduced we should be able to diagnose this.
    4. Can you clarify your typical payment process. I note from your logs that you had orders created (with a status of pending) which where then updated (5 seconds later) to a status of on-hold. What payment providers are you using? (just PayPal?). I would like to understand why the orders are going on-hold, so that I understand your woocommerce setup/configuration a little better.
    5. Can you send me a list of all the plug-ins (with versions) that you have installed. It is useful to know this since plugins don’t always play nicely together.


    My checkout page keeps on loading very slow too
    Any fix to it?
    Can you help me.
    Thanks a lot

    Moderator Steven Stern


    Support Team Volunteer


    Please open a new thread for your question. Please do not hijack / add-on to existing threads. Thanks.

    Plugin Author mtreherne


    Hi atman1 – please let me know if you are still using the plugin. If I don’t hear from you I will close the thread. It’s been 9 months since my last update, so I guess the problem was either resolved or you are no longer using the plugin.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Slow checkout’ is closed to new replies.