Articles in this section

Sync inventory transfers between NetSuite and Shopify

The Inventory Transfer module synchronizes the movement of stock between warehouse locations. When stock is transferred between locations in NetSuite (via a Transfer Order), this module pushes that transfer to Shopify as an inventory transfer. When the receiving location in Shopify confirms receipt of the transferred stock, the module creates an Item Receipt in NetSuite to close the loop.

This module is available only in the D2C template; it is not part of the Shopify – NetSuite integration app.

A8.png

Flow 1: NetSuite inventory to Shopify inventory (add or update)

This flow exports Quantity Available from NetSuite and updates the corresponding inventory levels in Shopify. An item is included in the export only when its Quantity Available has changed since the last flow run.

How the flow works
  1. Get inventory records from NetSuite (Export): Uses saved search customsearch_celigo_shopify_inv_sync_exp. The search returns quantity data grouped by item and location. For kit items and item groups, the script computes per-location availability as MIN(floor(componentAvailable / requiredQty)) across all components, ensuring kits are not oversold if any component is out of stock.

  2. Get product active locations from Shopify (Lookup): Uses the GraphQL inventoryItem(id).inventoryLevels(first: 200) query to retrieve the Shopify locations where the inventory item is currently active.

  3. Activate location for product in Shopify (Import): If the Shopify location is not yet active for this inventory item, activates it before attempting to set the inventory quantity.

  4. Post inventory to Shopify (Import): Updates inventory quantities in Shopify using a GraphQL mutation (inventorySetQuantities) via HTTP POST, mapping item IDs, locations, and quantities with one-to-one processing and error handling to ensure accurate updates.

Flow 2: NetSuite Transfer Orders to Shopify Inventory Transfer (add or update)

This flow exports Transfer Orders from NetSuite and creates or updates corresponding Inventory Transfers in Shopify.

How the flow works
  1. Get transfer orders from NetSuite (Export): Uses saved search customsearch_celigo_shopify_tro_to_expor (delta) to find Transfer Orders ready to be synced to Shopify. The search returns one row per line item, with header-level and item-level fields. The pre-save script assembles rows into a header-and-items structure.

  2. Get transfer status from Shopify (Lookup): Retrieves the current status and line item details of a Shopify inventory transfer using the shopifyTransferId, enabling validation and comparison before updates.

  3. Router (Create, Update, or Cancel) (Import): Transfer Order Router - first matching branch

  • Post inventory transfer to Shopify: Creates a new inventory transfer in Shopify by sending origin, destination, and line item details when no Shopify Transfer ID exists.

  • Mark transfer as ready to ship in Shopify: Updates the Shopify transfer status to “Ready to Ship” after successful creation.

  • Update transfer order in NetSuite: Updates the NetSuite Transfer Order with the Shopify Transfer ID and sync status for tracking and future updates.

  • Remove transfer items in Shopify: Removes closed or inactive items from the existing Shopify transfer based on items marked for removal.

  • Replace transfer items in Shopify: Updates active transfer items in Shopify by replacing quantities and item details with the latest data from NetSuite.

  • Mark transfer as ready to ship in Shopify: Updates the Shopify transfer status to “Ready to Ship” after item updates, for eligible transfers.

  • Post transfer cancellation to Shopify: Cancels the existing Shopify inventory transfer using the transfer ID when the Transfer Order is cancelled in NetSuite.

  • Create: The Transfer Order does not have a Shopify Transfer ID populated; a new Shopify inventory transfer will be created.

  • Update: The Transfer Order has a Shopify Transfer ID; the existing Shopify inventory transfer will be updated.

  • Cancel: The Transfer Order has been cancelled in NetSuite, and the Shopify inventory transfer will be cancelled.

For the Update branch, the script separates line items into itemsToUpdate (active items) and itemsToRemove (closed items where isClosed = "T"). Items to be updated must have Shopify Product ID, Variant ID, and Inventory Item ID populated.

Location mapping

The pre-save script resolves origin and destination locations for the transfer using the Locations mapping in integration settings. Both the origin NetSuite location and the destination NetSuite location must be mapped to Shopify locations for the transfer to be created successfully.

If a required location mapping is missing, the flow will error with: "Missing Shopify item mapping for: [SKU]" for unmapped items, or a location resolution error for unmapped locations.

Important

All items on the Transfer Order must have their Shopify Product ID, Variant ID, and Inventory Item ID populated in the NetSuite item record (via the item ID map flow) before this flow can process the Transfer Order. If any item is missing its Shopify mapping, the entire transfer will error.

Flow 3: Shopify received Inventory Transfer to NetSuite Item Receipt for Transfer (add)

This flow monitors Shopify inventory transfers that have been received and creates corresponding Item Receipt records in NetSuite against the originating Transfer Order.

How the flow works
  • Extracts legacy IDs from all Shopify GIDs.

  • Maps the Shopify locations to NetSuite locations using the Locations mapping.

  • Flattens shipments.nodes into a shipments array, keeping only shipment line items with acceptedQuantity > 0.

  • Removes shipments that have no accepted line items after filtering.

  1. Get inventory transfers from Shopify (Export): Uses the GraphQL inventoryTransfers(first, query, after) query (delta-based) to find inventory transfers that have been received in Shopify since the last flow run. The pre-save script processes the transfer data:

  2. Post item receipt to NetSuite (Import): Creates Item Receipt records in NetSuite for the corresponding Transfer Order (identified by the Shopify Transfer ID and resolved via lookup), recording received quantities for each shipment using one-to-many processing.

Creates Item Receipt records in NetSuite for the corresponding Transfer Order (resolved via lookup), recording received quantities for each shipment using one-to-many processing.

Known limitations

  • All items in a Transfer Order must have Shopify mappings. A single unmapped item will cause the entire transfer to fail.

  • Partial receipts: only shipment line items with acceptedQuantity > 0 are included in the Item Receipt.