protected function UPSRateBase::rateMarkup in Ubercart 8.4
Modifies the rate received from UPS before displaying to the customer.
Parameters
float $rate: Shipping rate without any rate markup.
Return value
float Shipping rate after markup.
File
- shipping/
uc_ups/ src/ Plugin/ Ubercart/ ShippingQuote/ UPSRateBase.php, line 364
Class
- UPSRateBase
- Common functionality for UPS shipping quotes plugins.
Namespace
Drupal\uc_ups\Plugin\Ubercart\ShippingQuoteCode
protected function rateMarkup($rate) {
$ups_config = \Drupal::config('uc_ups.settings');
$markup = trim($ups_config
->get('rate_markup'));
$type = $ups_config
->get('rate_markup_type');
if (is_numeric($markup)) {
switch ($type) {
case 'percentage':
return $rate + $rate * floatval($markup) / 100;
case 'multiplier':
return $rate * floatval($markup);
case 'currency':
return $rate + floatval($markup);
}
}
else {
return $rate;
}
}