# Shopify > Brightpearl - sync locations

## Introduction

The `Shopify > Brightpearl - sync locations` flow retrieves all locations from Shopify and then all locations from Brightpearl. A script determines if a location (i.e. warehouse) exists in Brightpearl - if no, a new warehouse is created and if yes, the existing warehouse is updated.&#x20;

{% hint style="info" %}
This blueprint includes two process flows to handle the sync of locations between Shopify and Brightpearl: Shopify > Brightpearl (detailed here) and [Brightpearl > Shopify](https://doc.wearepatchworks.com/product-documentation/blueprints/patchworks-blueprints/shopify-and-brightpearl/available-process-flows-shopify-and-brightpearl/brightpearl-greater-than-shopify-sync-locations). You only need to run ONE, depending on which way you want the sync to work.
{% endhint %}

## Process flow snapshot

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FSUvxsp8XwrC9qsafJMIe%2Ficon%20process%20flow.svg?alt=media&#x26;token=ad1dc886-4a4e-4cad-9ad0-3d755e0f3b5a" alt="" data-size="line"> Click to view process flow snapshot</summary>

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fsgsv8Obbqws5MoVTCeax%2F%20Shopify%20%3E%20Brightpearl%20-%20sync%20locations%20-%20full%20flow.png?alt=media&#x26;token=e7562e9f-7849-4600-84b8-c10a0a67f625" alt=""><figcaption></figcaption></figure>

</details>

## Limitations

<table><thead><tr><th width="266.79296875">Limitation</th><th>Summary</th></tr></thead><tbody><tr><td>All locations/warehouses are synced</td><td>There is no option to limit which locations/warehouses are synced.</td></tr></tbody></table>

## Assumptions

<table><thead><tr><th width="266.79296875">Assumption</th><th>Summary</th></tr></thead><tbody><tr><td>Shopify data</td><td>It is assumed that data in Shopify is correct and up to date at the time this process flow is run.</td></tr><tr><td>Sync direction</td><td>Running this flow assumes that you want to sync prices in this direction (i.e. from Shopify > Brightpearl). If required, a flow for the reverse direction is<a href="shopify-greater-than-brightpearl-fulfillment"> </a>available (<a href="brightpearl-greater-than-shopify-sync-locations">Brightpearl > Shopify - sync locations</a>). You should run one or the other.</td></tr></tbody></table>

## Customisation

To ensure that this process flow runs as required, some customisation options are available. These are documented in the following sections:

* [Flow variables](#flow-variables)
* [Process shape shapes](#process-flow-shapes)

### Flow variables

This process flow does not use flow variables.

### Process flow shapes

This process flow includes some shapes that can be configured with your own settings. Please see guidelines in the table below.

{% hint style="warning" %}
Shape settings determine the outcome of process flows. Do not change shape settings unless they are listed below.&#x20;
{% endhint %}

<table data-full-width="false"><thead><tr><th width="190.171875">Shape</th><th>Notes</th></tr></thead><tbody><tr><td>Trigger</td><td>No default schedule is set for this flow. If you decide to sync locations in this direction (rather than from <a href="brightpearl-greater-than-shopify-sync-locations">Brightpearl to Shopify</a>), you may wish to add your own schedule. </td></tr><tr><td>Connector (Shopify)</td><td>If you did not add or select a Shopify instance during the blueprint <a href="../../shopify-and-netsuite/installation-guide-shopify-and-netsuite/stage-4-install-the-blueprint-shopify-and-netsuite">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Get all locations via graphql</code></td></tr><tr><td>Connector (Brightpearl)</td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="../installation-guide-shopify-and-brightpearl">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> :  Set to <code>GET Get all warehouses</code><br><code>Updated at</code> : Set to <code>{{flow.variables.updatedat}}</code> <br><br><code>Updated at</code> references a <a href="#flow-variables">flow variable value</a>, defined in process flow settings.</td></tr><tr><td>Script</td><td>The <code>Shopify to BP - Determine new and updated locations</code> script can be updated if additional location details are required.</td></tr><tr><td>Branch</td><td>Two branches are defined - one creates new locations and the other updates existing locations. If you do not wish to update locations, this branch can be <a href="../../../../../process-flows/building-process-flows/process-flow-shapes/standard-shapes/branch-shape#deleting-a-branch">removed</a>. </td></tr><tr><td>Connector (Brightpearl)<br><code>Branch</code>: <code>New location</code> </td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="../installation-guide-shopify-and-brightpearl">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Create new locations</code></td></tr><tr><td>Connector (Brightpearl)<br><code>Branch</code>: <code>New location</code> </td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="../installation-guide-shopify-and-brightpearl">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Create new warehouses</code></td></tr><tr><td>Connector (Brightpearl)<br><code>Branch</code>: <code>Update location</code> </td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="../installation-guide-shopify-and-brightpearl">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Update warehouse addresses</code></td></tr><tr><td>Connector (Brightpearl)<br><code>Branch</code>: <code>Update location</code> </td><td>If you did not add or select a Brightpearl instance during the blueprint <a href="../installation-guide-shopify-and-brightpearl">installation process</a>, the following settings must be configured:<br><br><code>Source instance</code> : Set to your required <code>Brightpearl</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Update warehouse addresses</code></td></tr></tbody></table>

## Reference

Reference information for this process flow is documented in the following sections:

* [Scripts used in this process flow](#scripts-in-this-process-flow)
* [Cross-reference lookups used in this process flow](#cross-reference-lookups-in-this-process-flow)

### Scripts in this process flow

<table><thead><tr><th width="293">Script</th><th>Summary</th></tr></thead><tbody><tr><td>BP to Shopify - Determine new and updated locations</td><td>Compares Brightpearl warehouses with Shopify locations, then creates or updates Shopify locations as needed.</td></tr></tbody></table>

### Cross-reference lookups in this process flow

This process flow does not use cross-reference lookups.
