You are here

public function TaxZone::getDefaultRate in Commerce Core 8.2

Gets the default tax rate.

Return value

\Drupal\commerce_tax\TaxRate The default rate.

File

modules/tax/src/TaxZone.php, line 177

Class

TaxZone
Represents a tax zone.

Namespace

Drupal\commerce_tax

Code

public function getDefaultRate() {
  $default_rate = reset($this->rates);
  foreach ($this->rates as $rate) {
    if ($rate
      ->isDefault()) {
      $default_rate = $rate;
      break;
    }
  }
  return $default_rate;
}