0

how can i get list of commerce order purchased by specific user programatically?

i want to create function for it so that other developers can use it in further development by simply calling that function. i want to get name of orders purchased by user based on uid.

i have used drupal commerce module for it,i am not getting any table column in database where i can get relevant data.

1

to get ALL orders of a user - get user ID ($user_id) then

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.