You are here

function uc_quote_condition_order_shipping_method in Ubercart 5

Same name and namespace in other branches
  1. 6.2 shipping/uc_quote/uc_quote.module \uc_quote_condition_order_shipping_method()
  2. 7.3 shipping/uc_quote/uc_quote.rules.inc \uc_quote_condition_order_shipping_method()

File

shipping/uc_quote/uc_quote.module, line 342
The controller module for fulfillment modules that process physical goods.

Code

function uc_quote_condition_order_shipping_method($order, $settings) {

  // Check the easy way first.
  if (is_array($order->quote)) {
    return $order->quote['method'] == $settings['method'];
  }

  // Otherwise, look harder.
  if (is_array($order->line_items)) {
    foreach ($order->line_items as $line_item) {
      if ($line_item['type'] == 'shipping' && in_array($line_item['title'], $settings['accessorials'])) {
        return TRUE;
      }
    }
  }
  return FALSE;
}