• Resolved wannabebond

    (@wannabebond)


    Hi. I am getting over reporting of purchases in Meta because a purchase event seems to be sent before payment is completed. My site redirects to payment gateway, and customer does not always complete the payment, so order remains “Pending Payment” but it seems Meta is getting confirmed purchase. Can we have option to only send purchase event when Thank You page is shown, or order status is “Processing”?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author shan

    (@suhanduman)

    Hello;

    Let me check the code and see what i can do. May be i can add an option for you.

    Kind regards

    Suhan

    Plugin Author shan

    (@suhanduman)

    Hello;

    The option you requested (along with some other minor fixes) has been released as version 3.8.0. I hope it’s what you wanted. If you encounter any problems or if it doesn’t work as intended, please let me know. I haven’t marked this thread as resolved yet.

    Kind regards

    Suhan

    Thread Starter wannabebond

    (@wannabebond)

    Thanks, I missed your reply. I have just updated, will make a big difference, thanks!

    Plugin Author shan

    (@suhanduman)

    You’re very welcome! Please let me know if it works exactly as expected once you have a chance to test it.

    If everything is running smoothly and you find the plugin useful, I would greatly appreciate it if you could take a moment to leave a review.

    Since this is a completely free community plugin, your reviews are incredibly helpful for other users.

    I’ll mark this thread as resolved for now, but feel free to open a new topic if you need anything else!

    Thread Starter wannabebond

    (@wannabebond)

    Hi Shan,

    I’m still getting reports to Meta on orders that are in status “Pending Payment”.

    My settings are:
    “Use separate Subscribe / SubscriptionRenewal events instead of Purchase” option for subscriptions.
    “Send Purchase when the order is: Processing, On hold, Completed”

    I tried checking log, but events are not in the last 50 events. Is there a way to export log?

    Plugin Author shan

    (@suhanduman)

    Hi,

    Thanks for the detailed report — listing your exact settings is what made it possible to test this properly. I’ve spent the morning reproducing your configuration against 3.10.0.

    First, what I was able to rule out. With your exact settings (Processing, On hold, Completed, plus separate Subscribe events), I put orders sitting in Pending Payment through all three code paths the plugin uses to report a sale. Nothing was emitted: no server-side event, no browser event, no queue entry, no log line. The status check runs before both halves of the reporting and before the subscription routing, so the Subscribe option can’t bypass it. I also confirmed the checkboxes you see on the settings screen are read from the very same function that enforces the rule, so the screen and the behaviour can’t disagree.

    So the plugin doesn’t report an order that is in Pending Payment at the moment of sending. That leaves two possibilities, and there’s one quick check that tells them apart.

    1. What event name does Meta show? This is the important one, and it needs nothing but a look at Events Manager. Because you have separate Subscribe events enabled, a subscription order can only reach Meta from this plugin under one of these names:
    • Subscribe — a new subscription sign-up
    • SubscriptionRenewal — a renewal (it arrives as a custom event)
    • Purchase — only for orders that contain no subscription

    If Events Manager is showing Purchase for one of these subscription orders, then that event did not come from this plugin and we should look at what else on the site reports to Meta. If it shows Subscribe or SubscriptionRenewal, it’s mine and we go to step 2.

    1. The order’s own history. Open one affected order and look at the Order notes panel on the right — WooCommerce records every status change there with a timestamp. My leading theory is that the order was reported earlier, while it was in a status you do track, and only moved to Pending Payment afterwards. On hold is the likely one: for bank transfer, cheque, and manual renewal payments, On hold means “waiting for payment”, so it is a pre-payment status in those setups. If the notes show Pending payment → On hold → Pending payment, that’s the whole answer, and unticking On hold fixes it.
    2. Two details: is the affected order a first sign-up or a renewal, and which payment gateway handles it? And is there any other plugin on the site that sends events to Meta?

    If you have WP-CLI access, this prints what the plugin recorded for a single order — its status, whether it was reported and under what name, and when:

    wp eval ‘$o=wc_get_order(12345); if(!$o){echo “No order with that ID.”; return;} echo $o->get_status().” | “.($o->get_meta(“_mcapi_purchase_sent”) ?: “NOT reported”).” | “.((int)$o->get_meta(“_mcapi_purchase_sent_at”) ? gmdate(“c”,(int)$o->get_meta(“_mcapi_purchase_sent_at”)) : “-“);’

    An affected order would come back looking like pending | Subscribe | 2026-08-28T09:27:41+00:00 — reported at a moment when it wasn’t pending, pending now. No CLI is fine; steps 1 and 2 above cover it.

    On the log. There’s no export today — that’s a fair gap and I’m adding one. Log has an event-type dropdown and a date range above the table, andSubscribe and Subscription Renewal are both in that dropdown. The 50-row limit applies to whatever you’ve filtered down to, so filtering by event type and date will surface entries the unfiltered “last 50” buries. Two things worth knowing: the log kdjustable 1–90 in the settings), so anything older has already been pruned,and each entry names the order, e.g. Order #1234 (status_changed).

    Thanks for flagging this. Whichever of the two it turns out to be, you’ve found a real gap: the log doesn’t currently record which status the order was in when it was reported, which is exactly what would have answered your question without any of the above.

    Kind regards
    Shan

    • This reply was modified 2 months, 1 week ago by shan.
    Plugin Author shan

    (@suhanduman)

    Hello Again;

    Thanks for sticking with this. I went through the send path line by line and then measured it, and
    I think I can tell you what’s happening — it’s real, but it isn’t coming from where we both assumed.

    First, what I verified on my side. I set up an order in Pending Payment and called every one of
    the three code paths that can send a Purchase (the thank-you page, the payment-complete hook, and a
    status change). With your settings — Processing, On hold, Completed — a pending order produced:

    • no Purchase sent to Meta
    • no event queued
    • nothing written to the log

    I ran the same test on a Processing order as a control, and that one did fire, so the test was
    genuinely measuring something. I also checked the two paths where the browser can ask the server to
    send an event: both have an allow-list, and Purchase, Subscribe and SubscriptionRenewal are not on
    either of them. So the plugin has no route — server-side or browser-side — that sends a sale for a
    pending order.

    Which means the conversions Meta is showing you are almost certainly being reported by something else on the site, and this explains why the setting didn’t help: that setting controls our sender, not anyone else’s.

    Here’s the mechanism, and it’s partly our fault. The GTM container we ship has a trigger that fires
    on any purchase event arriving in the dataLayer — it doesn’t check where it came from. So if a
    second plugin pushes a purchase event on the order-received page, our container faithfully turns
    it into a Meta (and TikTok, and Google Ads) conversion. Plugins in this category commonly fire on
    “customer reached the order-received page” without checking the order’s status — and with a redirect
    gateway like yours, a customer who abandons payment still reaches that page. That produces a
    conversion for a pending order, from a path that never touches our plugin, our queue, or our log.

    A two-minute check that will confirm or rule this out. Open the order-received page for one of
    these pending orders (the “Order received” URL from the order screen), open your browser’s developer
    console, and paste:

    window.dataLayer.filter(e => e && e.event === 'purchase')
      .map(e => ({ event_id: e.event_id || '(none)', order: e.ecommerce && e.ecommerce.transaction_id }))

    Every purchase event our plugin pushes carries an event_id. So:

    • no rows at all — nothing is firing there, and we should look elsewhere; tell me and I’ll dig further.
    • one row, with an event_id — that one is ours.
    • any row with event_id: '(none)', or more than one row — that’s the second publisher, and
      that’s your over-reporting. The extra one is what Meta is counting.

    Two things I’m fixing on our side because of this, both in the next release:

    1. The container trigger will require our own event_id, so it stops converting other plugins’
      purchase events into conversions. This is the actual fix for what you’re seeing, and it’s a
      container change — you’ll need to re-import the template once it’s out.
    2. A health check that tells you when a second source is pushing purchase events, instead of
      leaving you to discover it from Meta’s numbers.

    On the log — you were right to be suspicious of it, and two separate things were wrong. The log
    is sorted by the conversion’s time rather than the time we sent it, and for a sale that fires late
    that time is backdated — so it can be written below rows that were logged before it and fall off the
    first page. That’s being fixed. And yes, CSV export is coming in the next release: a button next
    to “Clear entire log” that exports everything matching whatever filter you have on screen, not just
    the 50 rows shown. It’ll carry both timestamps, so this particular confusion can’t repeat.

    In the meantime, if you want to see whether we ever sent anything for a specific order, this answers
    it directly — replace 1234 with the order number:

    wp eval 'echo get_post_meta(1234, "_mcapi_purchase_sent", true) ? "our plugin sent a Purchase for this order" : "our plugin never sent a Purchase for this order";'

    If that prints “never sent” for an order Meta reported, the console check above will show you who
    did. Post what you get and I’ll take it from there.

    Kind regards
    Shan

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

You must be logged in to reply to this topic.