You are here

commerce_free_shipping.install in Commerce Free Shipping 7

Commerce Free Shipping install function

File

commerce_free_shipping.install
View source
<?php

/**
 * @file
 * Commerce Free Shipping install function
 */

/**
 * Implements hook_uninstall().
 */
function commerce_free_shipping_uninstall() {
  $shipping_services = commerce_shipping_services();
  foreach ($shipping_services as $service) {
    $base = $service['base'];
    variable_del($base . '_free_shipping_enabled');
    variable_del($base . '_free_shipping_rate_limit');
    variable_del($base . '_free_shipping_rate_limit_currency');
    variable_del($base . '_free_shipping_excluded_line_item_types');
    variable_del($base . '_free_shipping_excluded_line_item_product_types');
    variable_del($base . '_free_shipping_gift_message_display');
    variable_del($base . '_free_shipping_gift_message');
    variable_del($base . '_free_shipping_reject_message_display');
    variable_del($base . '_free_shipping_reject_message');
    variable_del($base . '_free_shipping_additionnal_rules');
    variable_del($base . '_free_shipping_rules_reject_message_display');
    variable_del($base . '_free_shipping_rules_reject_message');
  }

  // Delete free shipping rules.
  $rules = rules_config_load_multiple(FALSE);
  foreach ($rules as $rule) {
    if (strpos($rule->name, 'commerce_free_shipping') === 0) {
      rules_config_delete(array(
        $rule->id,
      ));
    }
  }
}

Functions