• Resolved Dennis Jansen

    (@dennisjjansen)


    After an initial WooCommerce checkout, my buyer is redirected to a one-click upsell page. Where accepting the one-click upsell (an online course) results in a SEPA Direct Debit transaction somewhere in the next couple of days. Where the order then gets the status “pending” and “Awaiting payment”.

    Access to their one-click upsell bought is done with a WC-AC Hook tag that triggers the automation with access details. I want to give buyers of the one-click upsell immediate access, instead of waiting till the SEPA transaction is done. Therefore the suffix “pending” needs to be added to the tag I set in the WC product. In my case, this would result in “SMS Gekocht (pending)”.

    The problem is that I don’t manage to get this tag from WC to AC, although I did accept the one-click upsell and it appears as a real order in my dashboard.

    I tried to enable “When order status is processing (rather than completed)” and “Add WooCommerce order status to tags”.

    In my WC-AC Hook log file, I see that in all the testing setups and attempts, one time the tag was successfully added:

    11-07-2022 @ 03:08:04 – Order ID = 8555 (Status = pending). Contact synced successfully (ActiveCampaign ID = 2891). Tags added: Klant (pending),SMS Gekocht (pending)

    But no matter how I try, test, and change settings now, the suffix pending tag of the one-click upsell product isn’t transferred to ActiveCampaign.

    (no problems with the initial purchase and its tag to AC, but that order is immediately paid and completed, so that’s different from a SEPA transaction that will take place in the future).

    Testing for hours now, can’t make it work, don’t know how to proceed from here. Thanks for helping me to solve this.

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

    (@mtreherne)

    Hi David,

    Looks like you have tried the right settings. Must be something special with the SEPA Direct Debit order flow.

    To help me understand, please can you take a look at one of the SEPA transaction orders when logged in as admin. When you look at an order you will see an ‘Order notes’ panel (if you don’t then select it from the screen options). The ‘Order notes’ will list all the transaction status changes and the dates/times.

    Please can you cut and paste all the notes for one of these SEPA transaction orders to this forum. If there is any sensitive data in the notes (there usually is not) then just remove.

    From that I should be able to understand the order flow and diagnose the problem.

    Thanks,
    Matt

    Thread Starter Dennis Jansen

    (@dennisjjansen)

    Hi Matt, thank you so much for getting back to me earlier. We figured out that it was something on the side of the checkout page plugin that wasn’t triggering the pending status, as we dived deep into the log files. Right now changes are made to the plugin to solve this.

    If there is anything I think you can do in this case, I will let you know and update the ticket. We can close the ticket for now. Thanks again, really appreciate your help and effort.

    Thread Starter Dennis Jansen

    (@dennisjjansen)

    Hi Matt, after lots of further testing, we figured out that in order to trigger the WC-AC Hook plugin at a WooCommerce one-click upsell with SEPA immediately, the following need to change in the WC-AC Hook plugin. This is what I got back:

    “What we find out is, they hooked their code to fire the tag on this hook:

    https://imgwxl.com/am/Screenshot-at-17-07-54.png

    i.e. solely works for the checkout orders and not the order created using code/API. They should change it to ‘woocommerce_new_order'”.

    To make it work for me at this moment, they’ve added an extra line in a snippet code that will execute this hook while ideal order in upsell so that it will fire the ActiveCampaign (pending) tags too.

    This is the snippet code they sent me:

    https://gist.github.com/xlplugins/1035421905d9b536c7927cf4f52ef0af

    Adding this to my website enabled ActiveCampaign to immediately trigger an automation to give people direct access to a course that they bought through a one-click upsell, trigger by the AC tag with suffix “pending”. Instead of waiting a few days for the SEPA direct debit transaction and then get access.

    Does this make sense to you?

    So, it’s working for me now, but with importing a snippet code to my website. I think other people probably face this issue as well. Might be interesting to add/implement this into the plugin. Curious about your thoughts, thanks.

    Dennis

    Plugin Author mtreherne

    (@mtreherne)

    Hi Dennis,

    The reason the ‘woocommerce_new_order’ hook was not used originally, is that when it is first triggered, the order items (products) are not available (i.e. if you use a method like $order->get_items() it will be empty). I need to retrieve the product tags, so I need the items.

    The ‘woocommerce_checkout_update_order_meta’ hook was a better option. Nowadays the more meaningfully named hook ‘woocommerce_checkout_order_created’ does exactly the same thing (actioned at same point in class-wc-checkout.php) i.e. it is the hook to use when you want a fully created and saved order.

    Bottom line is that I cannot simply switch hook to use ‘woocommerce_new_order’, without unintended consequences. Nonetheless the handling of orders not initially created at checkout is something I would like to improve. Currently all order status changes are picked up, but as you have found out orders created outside of checkout (whether manually through admin or through code/API) will only be picked up on status change. If they were initially created outside checkout, with an initial status of complete then they would be missed altogether by this plugin, since there would never be a status change to trigger a sync with AC.

    So I intend to take a another look at this. Woocommerce has evolved since I first created this plugin. It should be possible to find a way of using the latest hooks available (such as woocommerce_new_order and woocomerce_update_order) to deal with orders that are not created by the checkout process. I can’t promise anything will get done (or when), but it is on my radar.

    By the way I think the workaround you have to trigger the hook using do_action(‘woocommerce_checkout_update_order_meta’) is probably the best way of handling your situation for now. For anyone else who reads this if you try this approach then be sure to test/check if any other plugins use this hook.

    Regards,
    Matt

    Thread Starter Dennis Jansen

    (@dennisjjansen)

    Thanks a lot Matt, that makes sense. I will use this info and the snippet code, which I see is the most convenient now. All the best for now and appreciate your help and feedback.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Pending order status tag to ActiveCampaign’ is closed to new replies.