You are here

function commerce_registration_order_has_registration in Commerce Registration 7.2

Same name and namespace in other branches
  1. 7 commerce_registration.rules.inc \commerce_registration_order_has_registration()

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

File

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

Code

function commerce_registration_order_has_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;
  }
  $id = $line_item_wrapper->commerce_product->product_id
    ->value();
  $settings = registration_entity_settings('commerce_product', $id);
  return !empty($settings);
}