hook_alloc_allocation

Definition

hook_alloc_allocation($txn, $balance)
ecommerce-5--4/docs/developer/hooks/ec_receipt.php, line 330

Description

tba (example is from store.module)

Related topics

Namesort iconDescription
HooksAllow modules to interact with the Drupal core.

Code

<?php
function hook_alloc_allocation($txn, $balance) {
  $is_shippable = FALSE;

  if (!empty($txn->items)) {
    foreach ($txn->items as $item) {
      if (product_is_shippable($item->vid)) {
        $is_shippable = TRUE;
        break;
      }
    }
  }

  if ($balance == 0) {
    $txn->allocation = EC_ALLOC_COMPLETED;
    if (!$is_shippable) {
      $txn->workflow = EC_WORKFLOW_COMPLETED;
    }
  }
  else {
    $txn->allocation = EC_ALLOC_PART;
  }

  store_transaction_save($txn);
}
?>