Skip to content

Commit

Permalink
fix: filter orders by customer is not working is fixed #452 (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
saimonh3 authored and sabbir1991 committed Dec 11, 2018
1 parent af8b689 commit 1dc2b25
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2884,17 +2884,18 @@ function dokan_is_store_open( $user_id ) {
* @return boolean
*/
function dokan_customer_has_order_from_this_seller( $customer_id, $seller_id = null ) {
$seller_id = ! empty( $seller_id ) ? $seller_id : get_current_user_id();
$args = array(
'author' => $seller_id,
$seller_id = ! empty( $seller_id ) ? $seller_id : dokan_get_current_user_id();
$args = [
'customer_id' => $customer_id,
'post_type' => 'shop_order',
'meta_key' => '_customer_user',
'meta_value' => $customer_id,
'meta_key' => '_dokan_vendor_id',
'meta_value' => $seller_id,
'post_status' => 'any',
'return' => 'ids',
'numberposts' => 1,
);
];

$orders = get_posts( $args );
$orders = wc_get_orders( $args );

return ! empty( $orders ) ? true : false;
}
Expand Down

0 comments on commit 1dc2b25

Please sign in to comment.