How to get user id of order from order entity metadata wrapper I am implementing hook_commerce_cart_line_item_refresh(). It will be receiving line item and entity metadata wrapper for the commerce order.

How can I get user id of order from its metadata wrapper without loading user object like this

$uid = $order_wrapper-&gt;owner-&gt;value()-&gt;uid


With above line it will be loading user object. I would like to avoid loading user object and simply take uid directly.

Following line does not work:

$uid = $order_wrapper-&gt;uid;


Or should I think of loading order object? As it might be already in static cache.

Thanks
It's the same as any property on a metadata wrapper:

$uid = $order_wrapper-&gt;uid-&gt;value();



  Or should I think of loading order object?


You can't have an entity metadata wrapper without an underlying entity, so the object you're referring to is already 'loaded'. You can get it with

$order = $order_wrapper-&gt;value();