> For the complete documentation index, see [llms.txt](https://docs.pyck.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pyck.cloud/shopify-app/routing.md).

# Sending data to several pyck tenants

Directing products, customers and orders at particular pyck tenants

Audience: Logistics Manager

One Shopify store can sync to several pyck tenants at once — a live warehouse and a test tenant, or two warehouses in different regions. Each of them is a **connection**, and each connection has a short **label** such as `production`, `stage` or `eu-prod`.

By default every tenant gets everything. Labels are how you narrow that down.

## The default: everything goes everywhere

A product, customer or order that carries no label at all is **broadcast** — delivered to every connection that is switched on and accepts broadcast.

That is the right behaviour most of the time. If you only have one connection, this is all that ever happens and you can stop reading here.

If no switched-on connection accepts broadcast, a record without a label goes nowhere: the sync fails and Activity says "No active pyck connection accepts broadcast entities."

## Narrowing with a label

Put a label on a record and it stops broadcasting. It goes to exactly the connections you named, and nowhere else. Naming a connection reaches it even if that connection has broadcast switched off.

There are two ways to write a label, and you can use either.

| Way                      | Where you set it                                                                                                          | Looks like         |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| The **pyck route** field | The pyck route field on the product, customer or order page in the Shopify admin. It is a list, so you can enter several. | `stage`            |
| A **tag**                | The record's tags                                                                                                         | `pyck-route-stage` |

Both do the same job. Use whichever fits how you already work — the field is easier to read at a glance, tags are easier to apply in bulk. Upper and lower case do not matter in either.

## The two ways add up — neither overrules the other

This is the part that surprises people.

The two signals are **combined**, not ranked. A record carrying the field `stage` and the tag `pyck-route-demo` goes to **both** `stage` and `demo`.

There is no way to say "ignore the tag, use the field". To stop a record reaching a tenant, remove the label that names it. Adding a different label somewhere else only adds a destination.

### Orders also inherit from their customer

An order also goes wherever its customer's labels point:

* the customer's `pyck-route-…` tags, read together with the order;
* the labels recorded for the customer the last time that customer synced. This is how the customer's **pyck route** field reaches the order.

So an order tagged `pyck-route-demo`, placed by a customer labelled `stage`, is delivered to **both**. Again, they add up.

Two things follow from this. A customer's pyck route field only reaches their orders after the customer has synced, so it does not work while customer sync is switched off. And a label on the customer that matches no connection stops every order of that customer, just like a label on the order itself.

## A label nobody recognises stops the sync

If you write a label that matches no connection on your store — a typo like `pyck-route-stagg`, or a connection that was deleted — the record **does not sync at all**. It is not partially delivered, and it does not quietly fall back to broadcast.

That is deliberate. You wrote a label because you wanted to restrict where the record goes. Treating an unrecognised label as "send it everywhere" would do the exact opposite of what you asked for and put your data in tenants you meant to exclude. Failing loudly is the safer answer.

The same applies to a label that names a connection you have switched off: the sync fails and says so, rather than delivering somewhere you did not name.

You will see the failure in **Activity**, with the offending label named: "Unknown pyck route label(s): …" or "Inactive pyck connection(s) named: …". Fix the label and the record syncs on its next change, or choose **Sync now** on the Home page.

A pyck route field the app cannot read, or one with an empty entry, stops the sync in the same way, with a message that the field "could not be resolved".

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

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

Every time an order syncs, the app writes down which connections 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 connection. 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](/shopify-app/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 Home 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.

{% hint style="warning" %}
**Make production lets the new production connection ship orders it received as a copy.** Shipping depends only on which connection is production *now*, and on which connections 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.
{% endhint %}

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](/shopify-app/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 excluded from the production connection no matter what labels it carries. It still reaches your other 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 connection — it goes nowhere, and Activity shows a failed sync: "Every routed connection was excluded by the test-order rule."

## Only production writes stock back

Stock only ever travels back to Shopify from the production connection. 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](/shopify-app/stock.md).

## Summary

| Situation                                                 | Where it goes                                                                                                            |
| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| No label anywhere                                         | Every switched-on connection that accepts broadcast                                                                      |
| No label, and no switched-on connection accepts broadcast | Nothing — the sync fails and is listed in Activity                                                                       |
| Field says `stage`                                        | `stage` only                                                                                                             |
| Tag says `pyck-route-stage`                               | `stage` only                                                                                                             |
| Field says `stage`, tag says `pyck-route-demo`            | Both `stage` and `demo`                                                                                                  |
| Order tagged `demo`, its customer labelled `stage`        | Both `demo` and `stage`                                                                                                  |
| Label names only a non-production connection              | That connection, as a copy. Nobody can ship the order                                                                    |
| Label matches nothing                                     | Nothing — the sync fails and is listed in Activity                                                                       |
| Label names a switched-off connection                     | Nothing — the sync fails and is listed in Activity                                                                       |
| Test order                                                | Everywhere it is routed, except production. Nobody can ship it. If that leaves nothing, the sync fails                   |
| Production is switched off                                | The other switched-on connections, as copies. Nobody can ship the order until it syncs again with production switched on |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pyck.cloud/shopify-app/routing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
