Commerce: retrieve coupon code used in order Using the Commerce Coupon module, how can I retrieve any coupon codes used in a particular order, given the order id? It seems that the coupons used are not actually stored in the database (as far as I can see).
If you're using 1.x version, an entity reference field is attached to the commerce order field upon installation (see function commerce_coupon_order_configuration()). This creates the field table commerce_coupon_order_reference.

To check coupons attached to an order, simply access the commerce_coupon_order_reference field, like:

if (!empty($order-&gt;commerce_coupon_order_reference)) {
  // Traverse the coupons referenced by this order.
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  foreach ($order_wrapper-&gt;commerce_coupon_order_reference as $coupon_wrapper) {
    dpm($coupon_wrapper-&gt;value());
  }
}