• Resolved malw

    (@malw)


    Is there a bulletproof way to get orders without using the column “completed”?


    We have code in ERP system, where we get orders from Woocommerce, to invoice them in ERP system. Web shop guy says, that we cannot use the “completed” column for this, since the shop has been running for years without completing orders. He’s afraid to set the completed flag, since that would trigger the mail logic etc. that runs when an order is completed.

    For now we have been getting orders with logic like this: …orders?status=’processing’?after=AFTER&before=BEFORE
    Where AFTER is timestamp for last time we retrieved orders and BEFORE is now().
    But this way is not bulletproof, because it seems this uses the creation date. If customer is modified while we get orders we would not get that order.

    How would we fix this? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @malw

    If you’re looking to retrieve orders without relying on the completed status, you may consider using the modified parameter in your API request instead of created. This way, you can retrieve orders that have been updated within a certain time frame.

    Your API request would look something like this: …orders?status=processing&after=AFTER&before=BEFORE&orderby=modified

    Here, AFTER is the timestamp for the last time you retrieved orders, BEFORE is now(), and orderby=modified will sort the orders by their last modification date.

    This should ensure you’re getting all orders, including those that have been updated or modified after creation, without triggering any unwanted actions tied to the completed status.

    Please note that writing or providing custom code is not within the scope of our support policy. If you are still having problems, we recommend asking development questions on the #developers channel of the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:

    I wish I could help more, but hopefully, this gets you going in the right direction to get the job done.

    Hey @malw!

    We haven’t heard from you in a while, so I’m going to mark this as resolved. Feel free to start a new thread if you have any more questions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘GET Orders API filter (not completed’ is closed to new replies.