diff --git a/tests/src/Unit/Order/OrderStatusTest.php b/tests/src/Unit/Order/OrderStatusTest.php
new file mode 100644
index 0000000..70d3e6e
--- /dev/null
+++ b/tests/src/Unit/Order/OrderStatusTest.php
@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\ubercart\Unit\Order\OrderStatusTest.
+ */
+
+namespace Drupal\Tests\ubercart\Unit\Order;
+
+use Drupal\Tests\UnitTestCase;
+use Drupal\uc_order\Entity\OrderStatus;
+
+/**
+ * @coversDefaultClass \Drupal\uc_order\Entity\OrderStatus
+ *
+ * @group Ubercart
+ */
+class OrderStatusTest extends UnitTestCase {
+
+  /**
+   * The tested order status.
+   *
+   * @var \Drupal\uc_order\Entity\OrderStatus
+   */
+  protected $orderStatus;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    $this->orderStatus = new OrderStatus([], 'order_status');
+  }
+
+  /**
+   * Tests that setState() throws an exception when the status is locked.
+   *
+   * @covers ::setState
+   * @expectedException \LogicException
+   */
+  public function testSetStateWhenLocked() {
+    $this->orderStatus->setLocked(TRUE);
+    $this->orderStatus->setState('state');
+  }
+
+  /**
+   * Tests that delete() throws an exception when the status is locked.
+   *
+   * @covers ::delete
+   * @expectedException \LogicException
+   */
+  public function testDeleteWhenLocked() {
+    $this->orderStatus->setLocked(TRUE);
+    $this->orderStatus->delete();
+  }
+
+}
diff --git a/uc_order/src/Entity/OrderStatus.php b/uc_order/src/Entity/OrderStatus.php
index 8d5faa2..042e7fa 100644
--- a/uc_order/src/Entity/OrderStatus.php
+++ b/uc_order/src/Entity/OrderStatus.php
@@ -90,6 +90,10 @@ class OrderStatus extends ConfigEntityBase implements OrderStatusInterface {
    * {@inheritdoc}
    */
   public function setState($state) {
+    if ($this->isLocked()) {
+      throw new \LogicException('Locked statuses cannot be modified.');
+    }
+
     $this->state = $state;
     return $this;
   }
@@ -127,6 +131,17 @@ class OrderStatus extends ConfigEntityBase implements OrderStatusInterface {
   /**
    * {@inheritdoc}
    */
+  public function delete() {
+    if ($this->isLocked()) {
+      throw new \LogicException('Locked statuses cannot be deleted.');
+    }
+
+    parent::delete();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public static function postLoad(EntityStorageInterface $storage, array &$entities) {
     parent::postLoad($storage, $entities);
     uasort($entities, 'static::sort');
diff --git a/uc_order/src/Form/OrderWorkflowForm.php b/uc_order/src/Form/OrderWorkflowForm.php
index 46b174e..1628697 100644
--- a/uc_order/src/Form/OrderWorkflowForm.php
+++ b/uc_order/src/Form/OrderWorkflowForm.php
@@ -9,6 +9,7 @@ namespace Drupal\uc_order\Form;
 
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\uc_order\Entity\OrderStatus;
 
 /**
  * Displays the order workflow form for order state and status customization.
@@ -36,7 +37,7 @@ class OrderWorkflowForm extends ConfigFormBase {
    */
   public function buildForm(array $form, FormStateInterface $form_state) {
     $states = uc_order_state_options_list();
-    $statuses = \Drupal\uc_order\Entity\OrderStatus::loadMultiple();
+    $statuses = OrderStatus::loadMultiple();
 
     $form['order_states'] = array(
       '#type' => 'details',
@@ -84,8 +85,6 @@ class OrderWorkflowForm extends ConfigFormBase {
     );
 
     foreach ($statuses as $status) {
-      $form['#locked'][$status->id()] = $status->isLocked();
-
       $form['order_statuses']['order_statuses'][$status->id()]['id'] = array(
         '#markup' => $status->id(),
       );
@@ -131,8 +130,8 @@ class OrderWorkflowForm extends ConfigFormBase {
     $config->save();
 
     foreach ($form_state->getValue('order_statuses') as $id => $value) {
-      $status = \Drupal\uc_order\Entity\OrderStatus::load($id);
-      if (!$form['#locked'][$id] && $value['remove']) {
+      $status = OrderStatus::load($id);
+      if (!empty($value['remove'])) {
         $status->delete();
         drupal_set_message(t('Order status %status removed.', ['%status' => $status->getName()]));
       }
@@ -141,7 +140,7 @@ class OrderWorkflowForm extends ConfigFormBase {
         $status->setWeight((int) $value['weight']);
 
         // The state cannot be changed if the status is locked.
-        if (!$form['#locked'][$key]) {
+        if (!$status->isLocked()) {
           $status->setState($value['state']);
         }
 
diff --git a/uc_order/src/Tests/OrderTest.php b/uc_order/src/Tests/OrderTest.php
index 5b995ca..f230fec 100644
--- a/uc_order/src/Tests/OrderTest.php
+++ b/uc_order/src/Tests/OrderTest.php
@@ -141,9 +141,6 @@ class OrderTest extends UbercartTestBase {
     $this->assertResponse(200, 'Customer can view their own order.');
 
     $this->drupalGet('admin/store/orders/' . $order->id());
-    $this->assertResponse(403, 'Customer may not see the admin view of their order.');
-
-    $this->drupalGet('admin/store/orders/' . $order->id() . '/edit');
     $this->assertResponse(403, 'Customer may not edit orders.');
 
     $this->drupalLogin($this->adminUser);
@@ -227,6 +224,10 @@ class OrderTest extends UbercartTestBase {
     $this->drupalPostForm('admin/store/orders/' . $order->id(), array('status' => $edit['id']), 'Update');
     $this->drupalGet('admin/store/orders/view');
     $this->assertText($edit['name'], 'Order displays custom status title.');
+
+    // Delete the custom order status.
+    $this->drupalPostForm('admin/store/settings/orders', ['order_statuses[' . $edit['id'] . '][remove]' => 1], 'Save configuration');
+    $this->assertNoText($edit['id'], 'Deleted status ID not found.');
   }
 
   protected function ucCreateOrder($customer) {
