You are here

function uc_tax_rate_delete in Ubercart 8.4

Deletes a tax rate from the database.

Parameters

$rate_id: The ID of the tax rate to delete.

File

uc_tax/uc_tax.module, line 374
Ubercart Tax module.

Code

function uc_tax_rate_delete($rate_id) {

  // Delete the tax rate record.
  $connection = \Drupal::database();
  $connection
    ->delete('uc_tax')
    ->condition('id', $rate_id)
    ->execute();
  $connection
    ->delete('uc_tax_taxed_product_types')
    ->condition('tax_id', $rate_id)
    ->execute();
  $connection
    ->delete('uc_tax_taxed_line_items')
    ->condition('tax_id', $rate_id)
    ->execute();

  // Delete the associated conditions if they have been saved to the database.
  // rules_config_delete(['uc_tax_' . $rate_id]);
}