You are here

function uc_usps_uc_shipping_type in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 shipping/uc_usps/uc_usps.module \uc_usps_uc_shipping_type()

Implements hook_uc_shipping_type().

File

shipping/uc_usps/uc_usps.module, line 147
United States Postal Service (USPS) shipping quote module.

Code

function uc_usps_uc_shipping_type() {
  $quote_config = \Drupal::config('uc_quote.settings');
  $weight = $quote_config
    ->get('type_weight', [
    'envelope' => -1,
    'small_package' => 0,
  ]);
  $types = [
    'envelope' => [
      'id' => 'envelope',
      'title' => t('Envelope'),
      'weight' => isset($weight['envelope']) ? $weight['envelope'] : -1,
    ],
    'small_package' => [
      'id' => 'small_package',
      'title' => t('Small package'),
      'weight' => isset($weight['small_package']) ? $weight['small_package'] : 0,
    ],
  ];
  return $types;
}