Articles in this section

Sync products and inventory from NetSuite to Shopify

The Product and Inventory module exports items from NetSuite and creates or updates the corresponding products and inventory levels in Shopify. NetSuite is the master system for product data; Shopify is the storefront.

This template uses the Shopify GraphQL productSet mutation for product creation and updates. The productSet mutation allows batch creation of all product variants in a single API call and supports up to 2,048 variants per product, removing the 100-variant limit of the legacy REST API.

Supported item types
  • Inventory items (matrix and non-matrix)

  • Assembly items (matrix and non-matrix)

  • Kit items / Item Groups

A1.png

Flow 1: Shopify products to item ID map (add/update)

This is the foundational flow for the entire product and inventory module. It queries all Shopify products and their variants and writes the Shopify Product ID and Variant ID back to each matching NetSuite item record. Every other flow in the product and inventory module, all order flows, depend on this mapping being in place.

Important

Run this flow before enabling order or inventory flows. If the Shopify Variant ID is not populated on a NetSuite item record, the order import will fail for that item with an item-not-found error.

How the flow works
  • Get products from Shopify (Export): Uses the GraphQL products(first, query, after) query (delta-based) to retrieve all products and their variants, including id, title, status, and variants.nodes with variant id, sku, and inventoryItem.id for each variant.

  • Find item (Lookup): Looks up the NetSuite item by SKU using saved search customsearch_celigo_shopify_item_id_map.

  • Create Shopify ID Map (Import): Updates the NetSuite item record with the Shopify Product ID, Variant ID, and Inventory Item ID in the eTail tab. These fields are used by all subsequent flows to locate the correct Shopify variant when syncing inventory or processing orders.

For more information about this flow, see Understand the Shopify products to item ID map flow.

Flow 2: NetSuite items to Shopify product (add or update)

This flow exports simple (non-matrix) inventory items, assembly items, and kit items from NetSuite and creates or updates the corresponding products in Shopify.

How the flow works
  • Get price lists Ids from Shopify (Lookup): Uses a GraphQL query to retrieve Shopify markets and their associated price list IDs. This lookup maps each market/catalog to its corresponding price list, which is required to update variant pricing.

  • Update price lists in Shopify (Import): Updates fixed prices for product variants in Shopify price lists using a GraphQL mutation. Processes one-to-many pricing records and applies amount, currency, and compare-at price for each variant.

  1. Get items from NetSuite (Export): Uses saved search customsearch_celigo_shopify_sim_item_exp to find items flagged for Shopify sync (eTail Channel = Shopify, store selected).

  2. Get product from Shopify (Lookup): Looks up the existing Shopify product by GID (using the Shopify Product ID stored in the NetSuite item record) or by SKU as a fallback. This determines whether the mutation should create a new product or update an existing one.

  3. Remove images from Shopify (Import): Removes any existing images from the Shopify product before uploading the updated image set from NetSuite. This ensures the product images in Shopify always reflect the current images in NetSuite.

  4. Post products to Shopify (Import): Creates or updates the Shopify product using the GraphQL productSet mutation. The pre-save script normalizes weight units (NetSuite format → Shopify WeightUnit enum), uppercases the inventory policy (CONTINUE or DENY), and resolves the price and compare-at price using the configured price level and currency settings.

  5. Update Price Lists per market (optional): If Sync price lists per market from NetSuite to Shopify is enabled, the router branches to an additional step that retrieves market price list IDs from Shopify and updates per-market prices using the priceListFixedPricesAdd GraphQL mutation.

Flow 3: NetSuite matrix item to Shopify product (add or update)

This flow exports parent matrix items and their child variant items from NetSuite and creates or updates multi-variant products in Shopify. The parent item becomes the Shopify Product; each child item becomes a Shopify Variant.

How the flow works
  • Get price lists Ids from Shopify (Lookup): Uses a GraphQL query to retrieve Shopify markets and their associated price list IDs. This lookup maps each market/catalog to its corresponding price list, which is required to update variant pricing.

  • Update price lists in Shopify (Import): Updates fixed prices for product variants in Shopify price lists using a GraphQL mutation. Processes one-to-many pricing records and applies amount, currency, and compare-at price for each variant.

  1. Get matrix items from NetSuite (Export): Uses saved search customsearch_celigo_shopify_m_item_exp to find parent matrix items and their child variants. Each row in the search result represents one child variant.

  2. Get product from Shopify (Lookup): Looks up the Shopify product by GID or by SKU. The postResponseMap script compares existing Shopify variants against NetSuite variants using an option-key matching algorithm (combining option names and values). Existing variants are updated; new variants are added; removed variants are marked for deletion.

  3. Remove images from Shopify (Import): Removes existing images from the Shopify product using a GraphQL mutation (productDeleteMedia) by passing the product ID and associated media IDs. This ensures that outdated images are cleared before uploading the latest images from NetSuite.

  4. Post products to Shopify (Import): Uses the productSetGraphQL mutation to create or update the product and all its variants in a single API call. The mutation supports up to 2,048 variants per product. Each variant includes: SKU, barcode (UPC), price, compare-at price, weight, weight unit, inventory policy, and inventory tracking setting.

  5. Update Price Lists per market (optional): If Sync price lists per market from NetSuite to Shopify is enabled, the router branches to an additional step that retrieves market price list IDs from Shopify and updates per-market prices using the priceListFixedPricesAdd GraphQL mutation.

Flow 4: NetSuite item metafields to Shopify Product metafields

This flow syncs item-level metafields defined in NetSuite to Shopify product and variant metafields. Configure the Shopify metafield components mapping (Product flow group settings) to define which NetSuite item fields map to which Shopify metafield namespace and key pairs.

How the flow works
  1. Get items from NetSuite (Export): Retrieves item records from NetSuite using a RESTlet-based export. It processes up to 100 records per batch without grouping by internal ID, ensuring each record is handled individually. A pre-send SuiteScript hook dynamically filters or transforms data before export, allowing flexible control over which items are included.

  2. Get product metafields data from Shopify (Lookup): Fetches existing product and variant metafields from Shopify using a GraphQL query. It looks up data based on product ID (GID) or SKU and retrieves metafield details along with their definitions. This step helps identify existing metafields and prepares data for comparison or updates.

  3. Post product metafields to Shopify (Import): Creates or updates product and variant metafields in Shopify using a GraphQL mutation. It dynamically maps source data to construct metafield inputs and ensures all records are processed. The response is used to track the success of each metafield operation.