You are here

function commerce_registration_line_item_is_registration in Commerce Registration 7.3

Condition callback.

Checks the commerce line item to see if the product is register enabled.

Parameters

CommerceLineItem $line_item: The Commerce Line Item to check for a register enabled product.

Return value

bool Boolean TRUE if the line item product is register enabled.

Related topics

2 calls to commerce_registration_line_item_is_registration()
commerce_registration_delete_registrations in ./commerce_registration.rules.inc
Action callback.
commerce_registration_set_state in ./commerce_registration.rules.inc
Action callback.

File

./commerce_registration.rules.inc, line 254
Commerce Registration rules file.

Code

function commerce_registration_line_item_is_registration($line_item) {
  $line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
  if (!in_array($line_item_wrapper->type
    ->value(), commerce_product_line_item_types())) {
    return FALSE;
  }
  $product_id = $line_item_wrapper->commerce_product->product_id
    ->value();
  return commerce_registration_product_has_registration_field($product_id);
}