Hi there 👋 !
It sounds like there is a Feature request about this functionality on GitHub. Please feel free to check the following link:
https://github.com/woocommerce/woocommerce-rest-api/issues/37
It seems that there are some workarounds for this 🙂
Cheers!
I got it working. Thanks.
Thread Starter
cimita
(@cimita)
Hi,
Thank you very much for your help.
I have been looking at the info @gabrielfuentes attached but something I must be doing wrong… because I can’t achieve to make it work. I’ll leave the steps I followed below maybe I did something wrong.
I added this code in my functions.php, then tested by going to: Analytics->Orders->Date Rage(today)->Show Advanced Filters->Add a filter(Order status Is Completed).
But I must be missing some step. It causes no change at all and shows 0 orders even tough I modified an order today by changing it from Processing to Completed…
Could you please share how did you achieved to do it @keithdjbsp?
Thank you very much.
add_filter( 'woocommerce_rest_prepare_order_object', 'last_modified_update', 10, 3 );
function last_modified_update( $response, $object, $request ) {
if (!isset($request->get_params()['last_modified'])) return $response;
if (strtotime($response->data['date_modified']) > strtotime($request->get_params()['last_modified'])){
return $response;
}
//return $response;
}
-
This reply was modified 5 years, 3 months ago by
cimita.
Sorry, the problem I solved was different than this. I’m new to this interface and replied in the wrong thread. I was getting help on another thread with Attributes and Variations which has since been resolved. Wish I could be more helpful. Good luck.
Hi @cimita. Sorry that we missed your response. The code that you found is for a different issue. There is no option to filter orders by order status modified date currently built into WooCommerce, as you’ve found.
Please add this as a suggestion to our [Ideas Board](hhttps://ideas.woocommerce.com/forums/133476-woocommerce). Our developers use that board to gauge community traction on what features to include in future versions.