You are here

function commerce_gc_commerce_price_formatted_components_alter in Commerce GC 7

File

./commerce_gc.module, line 1081
Provides Giftcard coupon bundle, Giftcard Transaction entity and basic user interface elements.

Code

function commerce_gc_commerce_price_formatted_components_alter(&$components, $price, $entity) {

  // Similar to the implementation in Commerce Discount.
  if (isset($price['data']['components'])) {

    // Loop into price components and alter the component title if the giftcard
    // component label is found.
    foreach ($price['data']['components'] as $component) {
      if (!isset($component['price']['data']['giftcard_component_title'])) {
        continue;
      }
      $components[$component['name']]['title'] = $component['price']['data']['giftcard_component_title'];
    }
  }
}