You are here

function commerce_order_types_order_type_delete in Commerce Order Types 7

Deletes an order type.

Parameters

string $type: The machine-readable name of the order type.

bool $skip_reset: Boolean indicating whether or not this delete should result in order types being reset and the menu being rebuilt; defaults to FALSE. This is useful when you intend to perform many saves at once, as menu rebuilding is very costly in terms of performance.

File

./commerce_order_types.module, line 206
Provides a UI for creating and managing custom order types.

Code

function commerce_order_types_order_type_delete($type, $skip_reset = FALSE) {
  $order_type = commerce_order_types_order_types($type);
  db_delete('commerce_order_types_order_types')
    ->condition('type', $type)
    ->execute();

  // Rebuild the menu to get rid of this type's order add menu item.
  if (!$skip_reset) {
    menu_rebuild();
  }

  // Notify the field API that this bundle has been destroyed.
  field_attach_delete_bundle('commerce_order', $type);
}