How can I programmatically get a list of orders purchased by a specific user?
to get ALL orders of a user - get user ID ($user_id)
then

$orders = \Drupal::entityTypeManager()
  -&gt;getStorage('commerce_order')
  -&gt;loadByProperties(['uid' =&gt; $user_id]);