# Brightpearl > Shopify - fulfillment

## Introduction

The process flow retrieves unfulfilled orders from Shopify, then cross-references with Brightpearl to see which ones have been fulfilled. Associated goods-out notes are pulled and manipulated before shipping information is sent to Shopify.

{% hint style="info" %}
This blueprint includes two process flows to handle the sync of fulfillments between Shopify and Brightpearl: Brightpearl > Shopify (detailed here) and [Shopify > Brightpearl](https://doc.wearepatchworks.com/product-documentation/blueprints/patchworks-blueprints/shopify-and-brightpearl/available-process-flows-shopify-and-brightpearl/shopify-greater-than-brightpearl-fulfillment). 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>

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FV0x110xmhqffRMbPqqbf%2FBrightpearl%20%3E%20Shopify%20-%20Fulfillment%20-%20full%20flow.png?alt=media&#x26;token=70b6813f-6edd-4f77-a06f-c356e838b3a7" alt="" width="360"><figcaption></figcaption></figure></div>

</details>

## Limitations

<table><thead><tr><th width="266.79296875">Limitation</th><th>Summary</th></tr></thead><tbody><tr><td>Standard shipments only</td><td>This flow does not support split shipments.</td></tr><tr><td>One-time fulfillments</td><td>A fulfilment will fail if the order has been fulfilled, cancelled and re-fulfilled.</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 fulfillments 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-fulfillment">Shopify > Brightpearl fulfillments</a>). You should run one or the other.</td></tr></tbody></table>

There are no assumptions to consider for this flow.

## 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

The table below summarises [flow variables](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables) defined for this process flow.

<table><thead><tr><th width="163.5078125">Flow variable</th><th>Summary</th><th>Default value</th></tr></thead><tbody><tr><td>datefrom</td><td>Set the relative number of days to look back for updates. Update the default value as required.<br><br>This variable is referenced in the first Shopify connector, where a filter query is defined to determine which fulfilled orders to pull.</td><td>-4 hours UTC</td></tr></tbody></table>

{% hint style="info" %}
For information on working with flow variables, please refer to our [flow variables documentation](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables).
{% endhint %}

### 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>No default schedule is defined. If you decide to sync in this direction (as opposed to syncing from <a href="shopify-greater-than-brightpearl-fulfillment">Shopify to Brightpearl</a>), you should set a schedule in line with your fulfillment requirements. For example, if warehouse activity stops at 6pm, you might run this flow at 7pm each day.</td></tr><tr><td>Connector (Shopify)</td><td><p>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 fulfilled orders via graphql</code><br><code>Filter</code> : The default filter references the <code>datefrom</code> <a href="#flow-variables">flow variable</a> as below:</p><pre data-overflow="wrap"><code>fulfillment_status:unfulfilled AND (financial_status:authorized OR financial_status:paid OR financial_status:pending) AND created_at:>='{{flow.variables.datefrom}}'
</code></pre></td></tr><tr><td>Connector (Brightpearl)</td><td><p>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</p><p><code>Source endpoint</code> :  Set to <code>GET Search orders</code><br><code>Parameters</code> :  A default filter is defined to search (and match) on <code>externalRef</code> where the value is set to <code>[[payload.ref]]</code>.</p></td></tr><tr><td>Connector (Brightpearl)</td><td><p>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</p><p><code>Source endpoint</code> :  Set to <code>GET Get goods out note</code><br><code>Order ID</code> :  Set to <code>[[payload.order_id]]</code>.</p></td></tr><tr><td>Connector (Shopify)</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 order for fulfillment via graphQL</code><br><code>Order ID</code> : Set to <code>[[payload.id]]</code></td></tr><tr><td>Connector (Shopify)</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 Fulfill orders via graphQL</code><br><code>Fulfillment Order ID</code> : Set to <code>[[payload.id]]</code><br><br><br><br><code>Tracking Number</code> : Set to <code>[[payload.tracking]]</code><br><br><code>Company</code> : Set to <code>[[payload.company]]</code><br></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>Reformat payload for filter</td><td>Takes raw Brightpearl API response data and transforms it into a clean, standardised structure. If no fulfillment data is found, the item is rejected.</td></tr></tbody></table>

### Cross-reference lookups in this process flow

This process flow does not use cross-reference lookups.
