Retrieve total amount and currency of a given order

Public

This code uses Entity API http://drupal.org/project/entity

</> CopyGet raw version
php
  1. // Load and wrap an order.
  2. $order = commerce_order_load($order_id);
  3. $wrapper = entity_metadata_wrapper('commerce_order', $order);
  4.  
  5. // Retrieve its total amount and currency code.
  6. $total_amount = $wrapper->commerce_order_total->amount->value();
  7. $total_currency = $wrapper->commerce_order_total->currency_code->value();