最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - WordPress WooCommerce Change Account Orders Page Query - Stack Overflow

programmeradmin2浏览0评论

I'd like to modify the MyAccount/Orders page to use a custom query. Basically I want to pull in all orders across users with a specific matching user meta field.

I have this query working and combining orders on a separate page but I'd like to edit the actual orders page. Here is what I have so far.

function my_show_orders($args) {
    $user_id = get_current_user_id();
    $meta_key = 'AccountNumber';
    $AccountNumber = get_user_meta($user_id, $meta_key, true);
    $shared_account_ids = my_function_get_users_by_meta_value($meta_key, $AccountNumber);

    $args['customer_id'] = $shared_account_ids;

    return $args;
}

add_filter('woocommerce_my_account_my_orders_query', 'my_show_orders', 20);

I double checked and $shared_account_ids does hold the IDs of the users I want to display orders from BUT I'm still only getting the current user's orders.

发布评论

评论列表(0)

  1. 暂无评论