• Resolved Marco Chiesi

    (@marcochiesi)


    Hi there,
    first of all, thank you for this very useful plugin!

    I think I’ve found a bug that causes some invoice numbers to be skipped.

    Sometimes the same order got assigned more than a single invoice number at the database level (even if there’s only one visible in the backend/frontend).
    Please see this screenshot: https://prnt.sc/jz5itc

    When this happens, the next invoice number is updated accordingly, so the visible effect is that there are missing invoice numbers.

    Apparently, this happens when an order receive multiple notifications that change its status to “Processing” multiple times (the plugin is configured to generate invoices for that status). In particular, this happens sometimes when an order paid with PayPal gets both a PDT and IPN notifications.
    See this other screenshot: https://prnt.sc/jz5nht (sorry, it’s in Italian but I hope you can get it).

    I hope you can help with this. I suppose it should be sufficient to prevent your plugin to reassign an invoice number is previously it was already assigned.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello Marco,
    Unfortunately there is nothing I can do about that at this point…

    I suppose it should be sufficient to prevent your plugin to reassign an invoice number is previously it was already assigned.

    The plugin already does this, but the particular issue at hand is a race condition, meaning that two processes are doing the same thing in parallel, so neither knows there is already a number.

    In it’s essence it’s a woocommerce issue that has been longstanding. There are plans to create a solution for this (here) but it’s a super complex problem. This affects more parts of WooCommerce, the customer will also receive the same email twice in this case, and depending on other plugins you use, they may also be triggered twice.

    The solution though, is pretty simple: make sure that you either use PDT or IPN, but never both. They serve the exact same purpose so you only need one. To disable PDT, clear the “PayPal identity token” in the PayPal gateway settings in WooCommerce, to disable IPN you will need to go to your PayPal merchant backend (where you can also disable PDT by the way).

    Good luck!

    Thread Starter Marco Chiesi

    (@marcochiesi)

    Hi @pomegranate,
    thank you very much for the explanation and for the tips.
    Now I disabled PDT as per your suggestion.
    Best,
    Marco

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug: skipped invoice numbers’ is closed to new replies.