You are here

function commerce_usps_rate_markup in Commerce USPS 7

Returns the marked-up rate.

Parameters

float $rate: A base USPS service rate.

Return value

float The rate after markup has been applied.

1 call to commerce_usps_rate_markup()
commerce_usps_rate in ./commerce_usps.module
Shipping service callback: returns a base price array for a shipping service calculated for the given order.

File

./commerce_usps.module, line 212
Defines the USPS shipping method and services for Drupal Commerce.

Code

function commerce_usps_rate_markup($rate) {
  $markup = variable_get('commerce_usps_markup');
  switch (variable_get('commerce_usps_markup_type', 'percentage')) {
    case 'amount':
      return $rate + $markup;
    default:

      // Percentage.
      return $rate * (1 + $markup / 100);
  }
}