• Hi,
    I’m no developper but I came close to doing what my customer wants which is to display and search woocommerce orders on the front end BUT restricting the results to the orders made by the currently logged-in user.
    I added this piece of code to the wcos-order-serch-list.php file and it does filter the results like I want but the search function does not work any longer as a result, any ideas on how to fix it ? thanks in advance

    $customer_orders = get_posts( array(
    ‘numberposts’ => -1,
    ‘meta_key’ => ‘_customer_user’,
    ‘meta_value’ => get_current_user_id(),
    ‘post_type’ => wc_get_order_types(),
    ‘post_status’ => array_keys( wc_get_order_statuses() ),
    ) );

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Restrict to logged-in user only’ is closed to new replies.