You are here

function commerce_gc_product_process_line_item_giftcards in Commerce GC 7

Run giftcard processing on a line item once for each quantity found

Parameters

EntityDrupalWrapper $line_item_wrapper:

2 calls to commerce_gc_product_process_line_item_giftcards()
commerce_gc_product_commerce_checkout_complete in modules/commerce_gc_product/commerce_gc_product.module
commerce_gc_product_submit_order_form_giftcard_purchases in modules/commerce_gc_product/commerce_gc_product.module

File

modules/commerce_gc_product/commerce_gc_product.module, line 382
Provides Giftcard product type and support.

Code

function commerce_gc_product_process_line_item_giftcards(EntityDrupalWrapper $line_item_wrapper) {

  // Process once for each quantity of each giftcard product line item.
  $i = 0;
  while ($i < $line_item_wrapper->quantity
    ->value()) {
    $i++;
    $line_item = $line_item_wrapper
      ->value();

    // Let rules/other modules execute actions.
    rules_invoke_all('commerce_gc_product_process_giftcard_line_item', $line_item);
  }
}