You are here

function commerce_shipping_rules_action_info in Commerce Shipping 7.2

Same name and namespace in other branches
  1. 7 commerce_shipping.rules.inc \commerce_shipping_rules_action_info()

Implements hook_rules_action_info().

File

./commerce_shipping.rules.inc, line 118
Rules integration for shipping.

Code

function commerce_shipping_rules_action_info() {
  $actions = array();
  if (count(commerce_shipping_services()) > 0) {
    $actions['commerce_shipping_service_rate_order'] = array(
      'label' => t('Add a rate for a shipping service to an order'),
      'parameter' => array(
        'shipping_service_name' => array(
          'type' => 'text',
          'label' => t('Shipping service'),
          'options list' => 'commerce_shipping_service_options_list',
        ),
        'commerce_order' => array(
          'type' => 'commerce_order',
          'label' => t('Order'),
        ),
      ),
      'group' => t('Commerce Shipping'),
    );
  }
  if (count(commerce_shipping_methods()) > 0) {
    $actions['commerce_shipping_method_collect_rates'] = array(
      'label' => t('Collect rates for a shipping method'),
      'parameter' => array(
        'shipping_method_name' => array(
          'type' => 'text',
          'label' => t('Shipping method'),
          'options list' => 'commerce_shipping_method_options_list',
        ),
        'commerce_order' => array(
          'type' => 'commerce_order',
          'label' => t('Order'),
        ),
      ),
      'group' => t('Commerce Shipping'),
    );
  }
  if (count(commerce_shipping_methods()) > 0) {
    $actions['commerce_shipping_rate_apply'] = array(
      'label' => t('Apply shipping rate to an order'),
      'parameter' => array(
        'commerce_order' => array(
          'type' => 'commerce_order',
          'label' => t('Order'),
          'save' => TRUE,
        ),
        'shipping_service_name' => array(
          'type' => 'text',
          'label' => t('Shipping service'),
          'options list' => 'commerce_shipping_service_options_list',
          'optional' => TRUE,
          'description' => t('If left empty, the first available shipping service will be applied.'),
        ),
      ),
      'group' => t('Commerce Shipping'),
    );
  }
  $actions['commerce_shipping_delete_shipping_line_items'] = array(
    'label' => t('Delete all shipping line items from an order'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
    ),
    'group' => t('Commerce Shipping'),
  );
  return $actions;
}