You are here

function uc_order_condition_subtotal in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 uc_order/uc_order.rules.inc \uc_order_condition_subtotal()

Compare order subtotal.

Parameters

object $order: The order to check.

string $op: The comparison operator.

float $value: The target value.

Return value

bool Whether the order subtotal meets the specified condition.

See also

uc_order_condition_value_operator_options

File

uc_order/uc_order.rules.inc, line 623
Rules integration for order-related entity events, conditions, and actions.

Code

function uc_order_condition_subtotal($order, $op, $value) {
  if (is_array($order->line_items)) {
    foreach ($order->line_items as $line_item) {
      if ($line_item['type'] == 'subtotal') {
        $subtotal = $line_item['amount'];
        return uc_order_condition_value_operator_comparison($subtotal, $op, $value);
      }
    }
  }
  return FALSE;
}