-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort and filter orders and other resource types by date modified #37
Comments
Is there any plan to address filtering by date modified anytime soon? This is a really important enhancement for us that will allow us to EFFICIENTLY identify orders that have been recently modified such that they are now eligible for import into our application. Our application looks for new and modified orders every hour for all WooCommerce stores across our customer base -- looking back many hours to many days on every hourly query for all WooCommerce stores across our customer base to catch updated orders that are now in an eligible state for import into our app is incredibly inefficient - the lack of this functionality negatively impacts our application performance and our customers who have WooCommerce stores. |
Filtering or Sorting on Modified Date is essential to this api functioning efficiently. I can't see any other way to detect modified orders, other than rescanning an entire range of old orders. This is fine for smaller projects, but we have hundreds of thousands of orders to scan if we want to be determinant. |
Same here: Our software processes orders for numerous WooCommerce merchants in order to automatically create invoices for them. This enhancement would be a great relief for us and our customers. |
@lester-fh , Sometimes I just need some helper code to get me started. This here will return a list of products that were modified since the passed parameter "last_modified". It will return the entire array of all products with an array key [0,1,2,3....] assigned to each (default api behavior). What this modification does, is it doesn't populate the data in the filtered records, so if you check that an entry has a particular key set, like "ID", then your program will process it. Otherwise, go to the next entry. Essentially, the products will be "filtered" so only valid entries are the ones with a last_modified date greater than 2018-01-23. To use this with orders, find and replace "product" to "order" i.e. change "woocommerce_rest_prepare_product_object" to "woocommerce_rest_prepare_order_object" This is in my functions.php file:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
We would be very grateful for this feature and appreciate your effort! |
This is absolutely essential to us and prevents us from migrating from legacy APIs to the later versions. I hope that newer WC versions won't remove the legacy v3 API before this is done. |
This comment has been minimized.
This comment has been minimized.
I've been working on upgrading our Legacy V3 support and just ran into this. This is an absolute blocker to moving to the new wc-json endpoints. |
This is really annoying. We have a case where occasionally webhooks don't fire so I need to check periodically. I'd rather not paginate all the order records as that will only get worse over time. The only I can see is to register a custom API endpoint so you have That does mean another round trip to the API using the list records and Docs for adding custom endpoints for anyone going down this particular rabbit hole of "fun" 😉 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@LucaQapla I'll post here when I have some news, if not, there is no news. |
@claudiosanches I can see that v3 of the API is out. Have this feature been implemented in this version? We've been wanting it for so long, and it doesn't make sense that our old API implementation is more feature rich than the newest. |
also interested… could not find this in the docs |
Hello, |
This comment has been minimized.
This comment has been minimized.
This is an essential function. |
It's a milestone for v4 so we'll see it when v4 is released i suppose. |
This has been on the roadmap for quite some time and originally was supposed to land in V3: #17262 Not sure if there is a recommendation for running WooCommerce in a connected eCommerce system where WooCommerce is just one piece of a puzzle besides an erp system or some sort of automated order processing system. Our current workaround is to use a webhook and periodically query for orders where the webhook has not fired properly. But it generates overhead and I would not recommend this for a high order load. |
I did pretty much similar setup for my clients. The performance is not very good though... |
This comment has been minimized.
This comment has been minimized.
I've reopened comments. Please keep on topic. Contributions are also welcome. |
Hi, I see the previous comment from Claudio was marked as outdated, I cannot find any information related to this topic in the new release, does it mean this feature is not included on the latest 3.6 version? |
Issue-Label Bot is automatically applying the label Links: app homepage, dashboard and code for this bot. |
Thank you for reporting this issue! I'm closing the issue as it already has a PR, please continue the discussion over at #30 |
@claudiosanches It looks like the linked ticket will only add filtering for Products / Variations. A lot of people are asking for filtering of orders in this issue. Is there another PR for filtering of Orders? |
@claudiosanches #30 Does NOT address this issue. |
@claudiosanches Yes, that does not address this issue. We would need to be able to filter for the modified date. |
Other issues DO NOT ADDRESS this one. |
Added another pull-request for querying orders as well by created and modified. #66 |
The lack of this feature makes integration with accounting systems incredibly difficult. Yes it is possible to create some kind of extension/plugin to deal with this but the reason we are trying to use the API is because plugins seem to be somewhat unreliable |
@claudiosanches if you merged both PR 66 and PR 30, then orders, products and product variants would support the requested filter, correct? You mentioned in the PR that the filter needs to be supported on all objects. Which ones? All that are documented in the API docs? Why would that be the case? What speaks against adding the filter option to objects where people actively requested their addition? |
Why this has not become a feature years ago is baffling to me. Would you just communicate if this is a feature that will be implemented or not? We have a ton of users who really need this feature, and we're constantly bombarded by issues because of this. |
This issue should get reopened. It was closed on Oct 4, 2019 because there was an open PR, but the PR was closed by @kepeder , without anything actually getting merged. The issue described here still remains, we are still looking for a way to only list orders modified after a certain date. |
Would this help, I just found this snippet and it works in backend: https://rudrastyh.com/wordpress/date-range-filter.html |
I merged multiple PRs into one, so that one is still open :-) |
I landed here, coming from an issue posted in 2017. |
Cannot believe that such a basic feature that has been continuously requested by the community over the past 3 year and it is STILL not implemented... |
We are considering this feature and it will get introduced in the next version of the REST API. |
It would be great! |
This worked for me. With Woo 4.0.x / API v3.
/wp-json/wc/v3/orders/?modified_after=2020-05-09T14:00:00 |
@androidcode33 Would this function be able to filter products by date_modified? |
@reason8910 No need to do any other changes. Let me know if it works for you or any other inquiries. thanks |
Wouldn't I need to change this line: woocommerce_rest_orders_prepare_object_query to woocommerce_rest_products_prepare_object_query |
@reason8910 this worked for me on orders. I haven't tested it with products. |
@claudiosanches awesome news that this will be taken care of! Could you please point readers of this conversation to the issue(s) that implement the requested features? I found this #226 but it only deals with ordering, filtering resources by modified date is not part of the change afaict. Thank you! |
I've founded it, it's "woocommerce_rest_product_object_query" |
Ref woocommerce/woocommerce#17262
The text was updated successfully, but these errors were encountered: