You can try something like this:
add_action( 'woocommerce_before_add_to_cart_form', 'add_list_completed_orders' );
function add_list_completed_orders() {
// get orders
$orders = wc_get_orders (
array (
'status' => array( 'wc-completed' ),
'type' => 'shop_order',
'limit' => -1,
'return' => 'ids',
'customer_id' => get_current_user_id(),
)
);
if ( ! empty( $orders ) ) {
// set value options
$options="";
foreach ( $orders as $order_id ) {
$options .= '<option value="' . $order_id . '">' . $order_id . '</option>';
}
// add list
$form = '<label for="orders">Select completed orders:</label>';
$form .= '<select id="orders" name="orders">' . $options . '</select>';
echo $form;
}
}
Tested and it works. The code goes into your theme’s functions.php.