function commerce_flat_rate_service_delete in Commerce Flat Rate 7
Deletes a flat rate service.
Parameters
$name: The machine-name of the flat rate service.
$skip_reset: Boolean indicating whether or not this delete should result in shipping services being reset and the menu being rebuilt; defaults to FALSE. This is useful when you intend to perform many deletions at once, as menu rebuilding is very costly in terms of performance.
1 call to commerce_flat_rate_service_delete()
- commerce_flat_rate_service_delete_form_submit in includes/
commerce_flat_rate.admin.inc - Submit callback for commerce_flat_rate_service_delete_form().
File
- ./
commerce_flat_rate.module, line 316 - Allows you to define any number of flat rate shipping services for customers to choose during checkout.
Code
function commerce_flat_rate_service_delete($name, $skip_reset = FALSE) {
$shipping_service = commerce_shipping_service_load($name);
db_delete('commerce_flat_rate_service')
->condition('name', $name)
->execute();
rules_config_delete(array(
'commerce_shipping_service_' . $name,
));
// Clear the necessary caches and rebuild the menu items.
if (!$skip_reset) {
commerce_shipping_services_reset();
entity_defaults_rebuild();
rules_clear_cache(TRUE);
menu_rebuild();
}
// Notify other modules that this flat rate service has been deleted.
module_invoke_all('commerce_flat_rate_service_delete', $shipping_service, $skip_reset);
}