diff --git a/composer.json b/composer.json
index 5342af5..39b0112 100644
--- a/composer.json
+++ b/composer.json
@@ -4,5 +4,8 @@
     "description": "Provides a DIBS payment gateway integration.",
     "require": {
         "drupal/commerce": "~2.9"
+    },
+    "require-dev": {
+        "drupal/commerce_shipping": "^8.x-2.0-rc2"
     }
 }
diff --git a/src/EasyOrderBuilder.php b/src/EasyOrderBuilder.php
index 7aa6775..2c5cc4b 100644
--- a/src/EasyOrderBuilder.php
+++ b/src/EasyOrderBuilder.php
@@ -41,7 +41,8 @@ class EasyOrderBuilder {
       ],
     ];
 
-    if ($shipments = $order->get('shipments')) {
+    if ($order->hasField('shipments') && !$order->get('shipments')->isEmpty()) {
+      $shipments = $order->get('shipments');
       /** @var \Drupal\commerce_shipping\Entity\ShipmentInterface $shipment */
       $shipment = $shipments->first()->entity;
       $profile = $shipment->getShippingProfile();
diff --git a/tests/src/Kernel/OrderBuilderTest.php b/tests/src/Kernel/OrderBuilderTest.php
new file mode 100644
index 0000000..23098a2
--- /dev/null
+++ b/tests/src/Kernel/OrderBuilderTest.php
@@ -0,0 +1,102 @@
+<?php
+
+namespace Drupal\Tests\commerce_dibs\Kernel;
+
+use Drupal\commerce_order\Entity\Order;
+use Drupal\commerce_order\Entity\OrderItem;
+use Drupal\commerce_order\Entity\OrderType;
+use Drupal\commerce_product\Entity\ProductVariationType;
+use Drupal\Tests\commerce_order\Kernel\OrderKernelTestBase;
+
+/**
+ * Dibs unit tests.
+ *
+ * @group commerce_dibs
+ */
+class OrderBuilderTest extends OrderKernelTestBase {
+
+  /**
+   * The test order.
+   *
+   * @var \Drupal\commerce_order\Entity\OrderInterface
+   */
+  protected $order;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = [
+    'commerce_dibs',
+    'commerce_shipping',
+    'physical',
+  ];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    parent::setUp();
+
+    // This is copy-pasted from commerce_shipping.
+    // Drupal\Tests\commerce_shipping\Kernel\ShippingKernelTestBase.
+    $this->installEntitySchema('commerce_shipping_method');
+    $this->installEntitySchema('commerce_shipment');
+    $this->installConfig([
+      'profile',
+      'commerce_product',
+      'commerce_order',
+      'commerce_shipping',
+    ]);
+    /** @var \Drupal\commerce_product\Entity\ProductVariationTypeInterface $product_variation_type */
+    $product_variation_type = ProductVariationType::load('default');
+    $product_variation_type->setGenerateTitle(FALSE);
+    $product_variation_type->save();
+    // Install the variation trait.
+    $trait_manager = $this->container->get('plugin.manager.commerce_entity_trait');
+    $trait = $trait_manager->createInstance('purchasable_entity_shippable');
+    $trait_manager->installTrait($trait, 'commerce_product_variation', 'default');
+
+    /** @var \Drupal\commerce_order\Entity\OrderTypeInterface $order_type */
+    $order_type = OrderType::load('default');
+    $order_type->setThirdPartySetting('commerce_shipping', 'shipment_type', 'default');
+    $order_type->save();
+    // Create the order field.
+    $field_definition = commerce_shipping_build_shipment_field_definition($order_type->id());
+    $this->container->get('commerce.configurable_field_manager')->createField($field_definition);
+
+    $this->order = Order::create([
+      'type' => 'default',
+      'state' => 'completed',
+      'mail' => 'test@example.com',
+      'ip_address' => '127.0.0.1',
+      'order_number' => '6',
+      'uid' => $this->createUser(),
+      'store_id' => $this->store,
+      'order_items' => [],
+    ]);
+  }
+
+  /**
+   * Test that we can order things even if the order has no shipment.
+   */
+  public function testOrderNoShipment() {
+    $order_item = OrderItem::create([
+      'type' => 'test',
+      'quantity' => '2',
+      'unit_price' => [
+        'number' => '20.00',
+        'currency_code' => 'USD',
+      ],
+    ]);
+    $order_item->save();
+    $this->order->addItem($order_item);
+    $this->order->save();
+    /** @var \Drupal\commerce_dibs\EasyOrderBuilder $builder */
+    $builder = $this->container->get('commerce_dibs.easy_order_builder');
+    $data = $builder->buildOrder($this->order);
+    $this->assertEqual($data["order"]["amount"], '4000');
+    $this->assertEqual($data["order"]["currency"], 'USD');
+    $this->assertEqual($data["order"]["reference"], $this->order->id());
+  }
+
+}
