You are here

function hook_uc_shipping_type in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 shipping/uc_quote/uc_quote.api.php \hook_uc_shipping_type()

Defines shipping types for shipping methods.

This hook defines a shipping type that this module is designed to handle. These types are specified by a machine- and human-readable name called 'id', and 'title' respectively. Shipping types may be set for individual products, manufacturers, and for the entire store catalog. Shipping modules should be careful to use the same shipping type ids as other similar shipping modules (i.e., FedEx and UPS both operate on "small package" shipments). Modules that do not fulfill orders may not need to implement this hook.

Return value

array An array of shipping types keyed by a machine-readable name.

4 functions implement hook_uc_shipping_type()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

uc_fulfillment_uc_shipping_type in shipping/uc_fulfillment/uc_fulfillment.module
Implements hook_uc_shipping_type().
uc_quote_uc_shipping_type in shipping/uc_quote/uc_quote.module
Implements hook_uc_shipping_type().
uc_ups_uc_shipping_type in shipping/uc_ups/uc_ups.module
Implements hook_uc_shipping_type().
uc_usps_uc_shipping_type in shipping/uc_usps/uc_usps.module
Implements hook_uc_shipping_type().

File

shipping/uc_quote/uc_quote.api.php, line 38
Hooks provided by the Shipping Quotes module.

Code

function hook_uc_shipping_type() {
  $weight = \Drupal::config('uc_quote.settings')
    ->get('type_weight');
  $types = [];
  $types['small_package'] = [
    'id' => 'small_package',
    'title' => t('Small package'),
    'weight' => $weight['small_package'],
  ];
  return $types;
}