# Brightpearl > Shopify - create/update companies, contacts & payment terms

## Introduction

This flow starts by retrieving contact details from Brightpearl. A script aggregates all contacts under their respective companies, designating a primary contact to populate the company's financial details. New companies are added to Shopify, and existing companies are updated.

## 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%2FR6VXFsLZdAX3Y1WyIjuq%2FBrightpearl%20%3E%20Shopify%20-%20Create%3Aupdate%20companies%20and%20contacts%20and%20payment%20terms%20-%20full%20flow.png?alt=media&#x26;token=00f5e096-4868-4182-8996-3332b4ff0d61" alt=""><figcaption></figcaption></figure>

</details>

## Limitations

<table><thead><tr><th width="266.79296875">Limitation</th><th>Summary</th></tr></thead><tbody><tr><td>Identifying updated companies in Brightpearl</td><td>Brightpearl does not have the facility to search for 'updated' companies, so all companies are retrieved and searched in Shopify.</td></tr></tbody></table>

## Assumptions

<table><thead><tr><th width="266.79296875">Assumption</th><th>Summary</th></tr></thead><tbody><tr><td>Sync direction</td><td>Running this flow assumes that you want to sync data in this direction (i.e. from Brightpearl to Shopify). If required, a flow for the reverse direction is<a href="shopify-greater-than-brightpearl-fulfillment"> </a>available (<a href="shopify-greater-than-brightpearl-company-and-contact-update-create">Shopify > Brightpearl -  company and contact update/create</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="220.09375">Shape</th><th>Notes</th></tr></thead><tbody><tr><td>Trigger</td><td>The default schedule for this flow is to run <code>daily at 05:00 PM</code>. This is the recommended run frequency but the schedule can be changed if necessary.</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 contacts</code></td></tr><tr><td>Filter</td><td>Having retrieved all contacts from Brightpearl, this filter shape determines the lookback period for the updatedOn timestamp. The default setting is <code>-24 hours</code> - you can change this as required (keeping your trigger schedule in mind).</td></tr><tr><td>Connector (Shopify)<br>branch: <code>first branch</code> </td><td>If you did not add or select a Shopify 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>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Get all companies contacts and locations</code>   <br><code>Company name</code> : Set to <code>[[payload.name]]</code></td></tr><tr><td>Connector (Shopify)<br>branch: <code>first branch</code> </td><td>If you did not add or select a Shopify 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>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Add new contact to company</code></td></tr><tr><td>Connector (Shopify)<br>branch: <code>first branch</code> </td><td>If you did not add or select a Shopify 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>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Add new company location via graphql</code>  </td></tr><tr><td>Connector (Shopify)<br>branch: <code>first branch</code> </td><td>If you did not add or select a Shopify 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>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Get all locations of company</code>   <br><code>Company ID</code> : Set to  <code>[[payload.shopify_company_id.0.shopify_company_id]]</code> </td></tr><tr><td>Connector (Shopify)<br>branch: <code>first branch</code> </td><td>If you did not add or select a Shopify 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>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Update payment terms</code> </td></tr><tr><td>Connector (Shopify)<br>branch: <code>second branch</code> <br>➤ <code>new contact</code></td><td>If you did not add or select a Shopify 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>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Add new contact to company</code> </td></tr><tr><td>Connector (Shopify)<br>branch: <code>second branch</code> <br>➤ <code>new location</code></td><td>If you did not add or select a Shopify 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>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Add B2B company location via graphql</code>  </td></tr><tr><td>Connector (Shopify)<br>branch: <code>second branch</code> <br>➤ <code>update net terms</code></td><td>If you did not add or select a Shopify 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>Shopify</code> instance.<br><code>Source endpoint</code> :  Set to <code>POST Update payment terms</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>Brightpearl - group companies</td><td>Groups Brightpearl companies for easier splitting.</td></tr><tr><td>BP to Shopify - Determine new or updated companies</td><td>Creates an array of Shopify addresses.</td></tr><tr><td>Inject company ID into multiple contacts</td><td>Structures a company contact correctly (for adding a new contact).</td></tr><tr><td>Brightpearl - inject company id when adding new location</td><td>Structures a company location correctly (for adding a new location).</td></tr><tr><td>Split locations for payment terms</td><td>Splits locations as needed for the creation of payment terms.</td></tr><tr><td>BP to Shopify - determine new contact and new locations to add</td><td>Creates arrays for new contacts and locations.</td></tr></tbody></table>

### Cross-reference lookups in this process flow

This process flow does not use cross-reference lookups.
