# Sending data to several Pyck tenants

Audience: Logistics Manager

Directing products, customers and orders at particular Pyck tenants

One Shopify store can sync to several Pyck tenants at once, for example a live tenant and a test tenant, or two tenants in different regions. The app shows each of them as a **warehouse**, and each warehouse has a short **label** such as `production`, `stage` or `eu-prod`.

Every tenant that is switched on gets everything, with one exception: a test order never reaches production (see [Test orders never reach production](#test-orders-never-reach-production)). You cannot send a single product, customer or order to one tenant only.

## Everything goes to every switched-on warehouse

A product, customer or order is delivered to **every warehouse that is switched on**. The one exception is an order Shopify marks as a test, which skips the production warehouse. There is no per-record narrowing: no field, tag or label on a record changes where it goes. To stop a tenant receiving data, switch its warehouse off.

If you only have one warehouse, this is all that ever happens and you can stop reading here.

If no warehouse is switched on, nothing is sent. Activity shows the record as skipped with "No warehouse is switched on". If a sync does reach the routing step with no switched-on warehouse, it fails with "No active Pyck connection is configured for this shop."

## What a label is

A label is the warehouse's name. It is unique within your store, and it is permanent: it cannot be changed once the warehouse is added. It is not a routing key.

A label uses lowercase letters and digits, with single hyphens between parts (`eu-prod`, not `EU_Prod` or `-eu`). It is at most 29 characters long.

## Being sent an order and shipping it are different things

Several tenants can hold the same order. Only the production warehouse may ship it, and only if the order was sent to it.

Every time an order syncs, the app writes down which warehouses it was sent to. That list replaces the one from the order's previous sync. When a tenant reports an order as shipped, two things are checked:

1. The tenant is your switched-on production warehouse. Every other tenant holding the order has a copy, so it can display the order or test against it, but it can never ship it. If it tries, it is refused.
2. The order's last sync sent it to production. If it did not, production is refused too.

This is what stops one order being packed and posted twice, and what keeps a test tenant from marking one of your real orders as shipped.

An order that was last synced while production was switched off was not sent to production, so **nobody can ship it**. That is the normal state of every order while production is switched off, which is how you run a test tenant before going live. See [Running a test tenant before go-live](https://docs.pyck.cloud/latest/shopify/test-tenant.md). The same goes for an order the app has never synced. Production can ship such an order once it syncs again with production switched on: change the order, or choose **Sync now** on the **Overview** page.

Because each sync replaces the list, this also works the other way round. If you switch production off and an order then changes, that sync does not reach production, and production cannot ship that order until it syncs again with production switched on.

:::caution
**Make production lets the new production warehouse ship orders it received as a copy.** Shipping depends only on which warehouse is production *now*, and on which warehouses the order was sent to. A tenant that received an order as a copy can ship it as soon as you make it production, even if your previous production warehouse is still picking that order. Before you choose **Make production**, agree with your team which warehouse finishes the orders that are already open.
:::

While Shopify locations are paired with the current production tenant's storage areas, **Make production** and **Make test copy** are refused until you remove those pairings. See [Warehouse stock](https://docs.pyck.cloud/latest/shopify/stock.md#1-pair-each-location-with-a-storage-area).

## Test orders never reach production

An order Shopify marks as a test (placed through the Bogus gateway or Shopify Payments test mode) is never delivered to the production warehouse. It still reaches your other switched-on tenants, which is usually the point of placing it. Because it never reaches production, nobody can ship it.

If production is the only place a test order would go (for example on a store with a single warehouse), it goes nowhere, and Activity shows a failed sync: "Every active connection was excluded by the test-order rule."

## Only production writes stock back

Stock only ever travels back to Shopify from the production warehouse. A staging or demo tenant's quantities are not real, and two tenants writing the same Shopify numbers would overwrite each other. See [Warehouse stock](https://docs.pyck.cloud/latest/shopify/stock.md).

## Summary

| Situation | Where it goes |
| --- | --- |
| A product, customer or order that is not a test order | Every switched-on warehouse |
| No warehouse is switched on | Nothing: the record is skipped with "No warehouse is switched on" |
| Production is switched off | The other switched-on warehouses, as copies. Nobody can ship the order until it syncs again with production switched on |
| Test order | Every switched-on warehouse except production. Nobody can ship it. If that leaves nothing, the sync fails |
