function commerce_registration_line_item_registration_allowed in Commerce Registration 7.3
Condition callback.
Checks if the line item product has registration capacity left. Capacity is only taken if an order is paid for in full.
Parameters
$line_item: Commerce Line Item to check the product for registration capacity.
Return value
bool Boolean TRUE if the product has registration capacity.
Related topics
File
- ./
commerce_registration.rules.inc, line 275 - Commerce Registration rules file.
Code
function commerce_registration_line_item_registration_allowed($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();
$quantity = $line_item_wrapper->quantity
->value();
return registration_status('commerce_product', $product_id, TRUE, $quantity);
}