at first, great product! It is really well-built and the code is spotless.
We are using HivePress alongside Listings, Marketplace, Reviews & Requests extensions. Now we want to create a cronjob which sends data for every order, where execution day = today.
How could we assign an execution_day custom field the best way, so we can query it later on via our script? Do custom attributes from a Request get automatically injected in a WooCom-Order or do we need to create two attributes which we map?
Your experienece regarding this would be a big help!
At least some kind of response is appreciated, you guys are advertising with 24-hour response timeframes. Are the attributes somewhere stored in the order, or is there a relatively easy way to retrieve orders based on requests attributes?
I’m sorry for the late reply and any inconvenience caused, there were temporary delays with developer-specific issues but this is resolved now.
Yes, you can retrieve the related request via the purchased product ID (the request ID is set in “post_parent” of the purchased product), but attributes are not available automatically, you have to get the request object by ID this way:
Thanks a lot, the answer was really great and helped me a lot. However, just a follow-up, if possible, how can we get both the sellers and buyers with their respective informations, based on the WooCommerce order?
If you use some callback functions with the order object available, you can get customer ID using the core WooCommerce function (user ID), and vendor ID by fetching the order meta (“hp_vendor” meta field). Vendor is a custom post type “hp_vendor” so you can fetch the post author, getting the vendor user this way.
If you mean paid requests added via the Requests extension, the easiest way is to retrieve the purchased product ID from the order and then getting the parent ID of this product get_post_parent() – Function | Developer.WordPress.org This is the request ID, which allows you to get the request object via HivePress\Models\Request::query()->get_by_id($id) and then fetch any request details: