# Creating orders with interfacility transfers

This page describes use cases where items should be transferred from one warehouse or store to another warehouse or store of the same retailer. These transfers ensure that items are available where and when they are needed.

{% hint style="warning" %}
Interfacility transfers are only available for [click & collect orders.](https://docs.fulfillmenttools.com/documentation/order-management#click-and-collect-order)
{% endhint %}

## Use case examples

### Expansion of the product range for a Click & Collect order

Interfacility transfers allow offering items for Click & Collect in multiple stores even though the item itself is not present in all of them. As soon as the item is requested in one of the stores, it can be transferred to the destination where it is needed.

When a customer places a Click & Collect order at a store and certain items are not in stock, those missing items can be transferred from another facility to the store where they are needed. That supplying facility fulfills the partial order and ships it to the facility where the customer placed the order. Once all items are available at the designated store, the customer can be informed that picking up the order is now possible.

### Item is out of stock in a brick-and-mortar store

Imagine a customer visiting a brick-and-mortar store to purchase a certain item but the item is not available at all or not available in the correct size or color. In that case, the store clerk can order the item from another facility where it is still available. The customer can then come back on a later day to try on and/or purchase the product in her store.

{% hint style="info" %}
This feature is currently only available via API.
{% endhint %}

## Implementation in fulfillmenttools

The described interfacility transfer process involves two types of facilities: a **receiving facility** in which the order can be picked up by the customer and a **supplying facility** from where the items are transferred.

### 1. Create an order including an interfacility transfer

Create an order and define the supplying facility in the order's delivery preferences.

1. De-activate the complete stock fence in the Backoffice under [DOMS Configuration](https://docs.fulfillmenttools.com/documentation/backoffice/network-view/orders/routing).
2. Activate the order split in the Backoffice under [DOMS Configuration](https://docs.fulfillmenttools.com/documentation/backoffice/network-view/orders/routing).
3. **Create a click & collect order**
   1. In the order's `deliveryPreferences`, the supplying facility must be explicitly set to indicate where the items will be sourced from.
      1. `facilityRef`: id of the facility that should receive the missing items
      2. `facilityRef` in `supplyingFacilitiesConfigurations`: Id(s) of the facility that should supply the missing items
      3. `deliveryEvents.deliveryTarget`: set to `"SHIP_TO_STORE"`
      4. `deliveryEvents.deliveryTrigger`: set to `"DEFAULT"`
   2. The order can be monitored in the [order view](https://docs.fulfillmenttools.com/documentation/backoffice/network-view/orders) in Backoffice

[REST API documentation](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#post-/api/orders) for creating an order

{% hint style="info" %}
If no items are available in the preferred facility, the system will still route the order to the next best facility for fulfillment based on configuration settings. A pickJob will be created in the preferred facility with only expected items.
{% endhint %}

**Example body information for `deliveryPreferences` of an order in the interfacility case:**

```
POST https://{YOUR_TENANT_NAME}.api.fulfillmenttools.com/api/orders
```

```json
{
    "orderDate": "<ORDER-DATE>",
    "consumer": { ...
    },
    "tenantOrderId": "<ORDER-ID>",
    "status": "OPEN",
    "orderLineItems": [ ...
    ],
    "deliveryPreferences": {
        "collect": [
            {
                "facilityRef": "<ID-RECEIVING-FACILITY>",
                "supplyingFacilitiesConfigurations": [
                    {
                        "facilityRef": "<ID-SUPPLYING-FACILITY>",
                        "deliveryEvents": [
                            {
                                "deliveryTarget": "SHIP_TO_STORE",
                                "deliveryTrigger": "DEFAULT"
                            }
                        ]
                    }
                ]
            }
        ]
    }
}
```

### 2. Picking and handover in supplying facility

* A regular `pickJob` is automatically created in the supplying facility containing all items that should be sent to the receiving facility. The `pickJob` can be carried out like any other "normal" `pickJob` via the [Operations Android or web app](https://docs.fulfillmenttools.com/documentation/apps/operations-app).
* Once the `pickJob` is processed and the items are packed, the `handoverJob` is completed and the items are handed over to a carrier who will ship the items to the facility specified in the order under `supplyingFacilities`. The hand over can be carried out like any other "normal" `handOverJob` via the [Operations Android or Web App](https://docs.fulfillmenttools.com/documentation/apps/operations-app). The address of the receiving facility will be displayed on the shipping label.
* The tasks can be monitored in the [task view](https://docs.fulfillmenttools.com/documentation/backoffice/network-view/orders) in Backoffice (tasks are not marked as belonging to an interfacility transfer).

### 3. Picking in receiving facility

* A `pickJob` is automatically created in the receiving facility containing all items that should be picked in the facility as well as expected items that are still needed to be transferred from the supplying facility.
* Users can start picking the already available items immediately.
  * The status of the `pickJob` is immediately set to open (`OPEN`), allowing picking to begin for available items. Once all available items are picked, the status of the `pickJob` is automatically changed to `WAITING_FOR_INPUT`.
  * In a case only part of the expected items arrive in a delivery, picking can continue until all expected items have arrived. Only when all items are picked, the `pickJob` is finalized and marked as finished.
* The `pickJob` can be monitored in the [task view](https://docs.fulfillmenttools.com/documentation/backoffice/network-view/orders) in Backoffice. In the task overview, information on the facility from which items are shipped is display for expected line items.

### 4. Transfer process and goods receipt

* After the `handoverJob` in the supplying facility is completed, an [`inboundProcess`](https://docs.fulfillmenttools.com/documentation/by-pillar/global-inventory-hub/inbound-process) with a `purchaseOrder` is created automatically in the receiving facility.

{% hint style="warning" %}
If there are two or more `handoverJobs` from different facilities, an `inboundProcess` is created for each facility.
{% endhint %}

* As soon as the `purchaseOrder` was created, the included items are announced in the receiving facility as [expected stock](https://docs.fulfillmenttools.com/documentation/by-pillar/global-inventory-hub/stock/expected-stock-in-availability). The transfer can be monitored in the [inbound view](https://docs.fulfillmenttools.com/documentation/backoffice/facility-view/inventory/inbound) in the Backoffice where it is marked as "internal".
* When the delivery has arrived in the receiving facility, it can be identified by scanning the `transferId`. The `transferId` is automatically written into the `scannableCodes` of the `inboundProcess`.
* The goods receipt can be performed via the [Inventory app](https://docs.fulfillmenttools.com/documentation/apps/inventory-app). Alternatively, a `receipt` can be directly added to the respective `inboundProcess` via [API](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#post-/api/inboundprocesses/-inboundProcessId-/receipts).
* After the `receipt` is set to status `FINISHED`, the expected stock is added to the inventory of the receiving facility and the `pickJob` is updated, converting expected items into existing items.

### 5. Finalizing the order

* After the missing items have arrived, the system updates the `pickJob` *and*:
  * Converts the expected items into regular items.
  * Changes the status of the `pickJob` to `OPEN`, allowing the picking process to continue or begin.
* With all items picked, the entire order can now be packed and is then ready for the handover to the customer.
* Picking, packing and handover can be performed as usual via the [Operations Android or web app](https://docs.fulfillmenttools.com/documentation/apps/operations-app).
