protected function USPSRateBase::weightMarkup in Ubercart 8.4
Modifies the weight of shipment before sending to USPS for a quote.
Parameters
$weight: Shipping weight without any weight markup.
Return value
Shipping weight after markup.
File
- shipping/
uc_usps/ src/ Plugin/ Ubercart/ ShippingQuote/ USPSRateBase.php, line 394
Class
- USPSRateBase
- Common functionality for USPS shipping quotes plugins.
Namespace
Drupal\uc_usps\Plugin\Ubercart\ShippingQuoteCode
protected function weightMarkup($weight) {
$usps_config = \Drupal::config('uc_usps.settings');
$markup = trim($usps_config
->get('weight_markup'));
$type = $usps_config
->get('weight_markup_type');
if (is_numeric($markup)) {
switch ($type) {
case 'percentage':
return $weight + $weight * floatval($markup) / 100;
case 'multiplier':
return $weight * floatval($markup);
case 'mass':
return $weight + floatval($markup);
}
}
else {
return $weight;
}
}