how can I get total price of all orders which owned by a single user? I want to assign different type of discounts by finding about total amount of their orders. I'm using


. should I use commerce_order_load_multiple() ?


I had a different approach to a similar scenario.

I created a field in the user profile that would store the total amount of orders so far. This field would be increased every time a new order was placed. Also created 3 different roles (silver, gold, platinum) Each role was entitled to different discounts. When the total order would pass the threshold value for the group, the user will be given that role.

  • your solution is totally perfect. tanx a lot. – weber85 Apr 23 '13 at 10:10

Try this

$orders = commerce_order_load_multiple(array(), array('uid' => $user_id));

You can use the conditions parameter of commerce_order_load_multiple.

  • tanx your code works fine. tanx – weber85 Apr 23 '13 at 10:10

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.