How to get the requests and bookings by current day

Hi,

we are using HivePress alongside with the Marketplace, Requests and Bookings Feature. Our issue is now that we are not able to get the “execution” dates for each listing date after a successfull booking.

The WooCommerce API just provides the Vendor-ID and the commission rate as custom attributes. The Listing API (enabled via WP Rest) provides just the listing themselves - how would we go about getting all bookings & requests where execution date == today?

Also, the hp_request returns only published items, whereas the requests which have been successfully placed are marked as private.

Quick help would be very much appreciated!

BR

Hi,

If you use the core WP REST API for fetching bookings and requests, please make sure that you also filter items by the post_status, e.g. you can provide an array of statuses to fetch both new and paid requests. If you mean getting requests by the publication date (unless there’s a custom Date attribute that you use to indicate the request start date) you can use the date query WP_Query – Class | Developer.WordPress.org For bookings, you can use the meta_query for the hp_start_time meta field, it stores a timestamp of the booking start.

Hope this helps.

Hey,

thanks for the quick response Ihor. I am using the WP REST API and have exposed hp_bookings, however I don’t see the hp_start_time meta field.

Also, I am using a custom attribute for the execution date of the requests - what would be in your opinion the best way to fetch all requests where custom execution_date == today?

BR

I’m sorry for the delay.

Please make sure that this booking is made via the website UI, because the start date is required for sure and it’s stored as a post meta field “hp_start_time”.

If the execution time is a custom date attribute you can try using meta_query, and cast the meta field value as date, for example custom post types - what is the correct way to compare dates in a WP query_posts meta_query - WordPress Development Stack Exchange By default, date attributes store values in Y-m-d format.

Hope this helps