function commerce_registration_line_item_is_on_waitlist in Commerce Registration 7
Condition callback.
Checks for an existing line item of the same product.
Related topics
1 string reference to 'commerce_registration_line_item_is_on_waitlist'
File
- ./
commerce_registration.rules.inc, line 327 - Commerce Registration rules file.
Code
function commerce_registration_line_item_is_on_waitlist($line_item) {
$line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
$order = commerce_order_load($line_item_wrapper->order_id
->value());
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
foreach ($order_wrapper->commerce_line_items as $delta => $combine_line_item_wrapper) {
// If this line item matches the product being added...
if ($combine_line_item_wrapper->type
->value() == 'waitlist' && $combine_line_item_wrapper->commerce_product->product_id
->value() == $line_item_wrapper->commerce_product->product_id
->value()) {
return TRUE;
}
}
return FALSE;
}