# Get 30d revenue from vendors via code

**URL:** <https://community.hivepress.io/t/get-30d-revenue-from-vendors-via-code/9258>\
**Category:** Marketplace\
**Tags:** marketplace, code\
**Created:** [January 16, 2024, 10:26pm UTC](https://community.hivepress.io/t/get-30d-revenue-from-vendors-via-code/9258 "2024-01-16T22:26:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrat](https://community.hivepress.io/user_avatar/community.hivepress.io/jrat/32/8249_2.png) [@jrat](https://community.hivepress.io/u/jrat)\
**Post date:** [January 16, 2024, 10:26pm UTC](https://community.hivepress.io/t/get-30d-revenue-from-vendors-via-code/9258/1 "2024-01-16T22:26:16Z")

</div>

Hey there,

is there a way to get the last 30d revenue from a vendor? We took a look at the code of the statistics plugin, however were unable to find a proper code snippet we could reuse for our case.

May you have something we could work with?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![jrat](https://community.hivepress.io/user_avatar/community.hivepress.io/jrat/32/8249_2.png) [@jrat](https://community.hivepress.io/u/jrat)\
**Post date:** [January 21, 2024, 3:25am UTC](https://community.hivepress.io/t/get-30d-revenue-from-vendors-via-code/9258/3 "2024-01-21T03:25:21Z")

</div>

At least a hint would be appreciated! Thanks a lot @ihor

---

<div class="post-metadata">

**Author:** ![ihor](https://community.hivepress.io/user_avatar/community.hivepress.io/ihor/32/5_2.png) [@ihor](https://community.hivepress.io/u/ihor)\
**Post date:** [January 22, 2024, 6:36pm UTC](https://community.hivepress.io/t/get-30d-revenue-from-vendors-via-code/9258/5 "2024-01-22T18:36:16Z")

</div>

I’m sorry for the delay. This is related to WooCommerce, please try using `wc_get_orders` function or a custom SQL query like this one [wordpress - Get WooCommerce Total Sales Dollar Amount (revenue) - Stack Overflow](https://stackoverflow.com/questions/51624701/get-woocommerce-total-sales-dollar-amount-revenue) to get a revenue of recent orders. You can filter orders by the post meta field `hp_vendor`, it stores the vendor ID.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![system](https://community.hivepress.io/user_avatar/community.hivepress.io/system/32/13990_2.png) [@system](https://community.hivepress.io/u/system)\
**Post date:** [February 21, 2024, 6:37pm UTC](https://community.hivepress.io/t/get-30d-revenue-from-vendors-via-code/9258/6 "2024-02-21T18:37:07Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
