Skip to main content

Shopify Mapping Functions

Reference for the Shopify-specific functions you can use in Dynamic Formula mappings and mapping collection filters.

Overview

The Shopify integration provides ready-made functions you can call when building mappings. They handle common lookups and conversions against your Shopify store and your iPaaS.com data, such as resolving products and variants by SKU, checking SKU uniqueness, converting categories, channels, and customer tags between the two systems, totaling order and gift card sales, and validating orders and fulfillments, so you do not have to write that logic yourself.

Where you can use these functions

These functions are available anywhere you write a formula for the Shopify integration:

  • Dynamic Formula mappings: where a destination field's value is produced by a formula rather than mapped directly from a source field.

  • Mapping collection filters: where a formula decides whether a record should be processed.

  • Error filters: a mapping collection's error filter, which sits alongside its collection filter. When the error filter's formula resolves to true, the transfer raises an error that is held in the Error Logs for review and is not retried automatically.

  • Translation collections: where a translation entry uses a formula as its source value.

How to use them

  • Call a function by name and pass the values it needs in parentheses, for example: await GetProductIdBySkuAsync(sku).

  • Each function's signature shows its name, the parameters it accepts (with their types), and the type of value it returns. Use it as the reference for exactly how to call the function.

  • Function names and formula syntax are case-sensitive, so type each name exactly as shown. Whether the values a function matches are treated as case-sensitive varies by function, and is called out in the relevant parameter's description.

  • Some of these functions are asynchronous (their signature returns a Task) and must be called with await; the rest are synchronous and are called directly. Each function's How to call it example shows the correct form.

  • Optional parameters are marked in the parameter table, along with the value used when you omit them.

  • Each function runs at sync time, against the data in your connected Shopify store and your iPaaS.com subscription.

The functions are grouped below by the area of the integration they support.

Products and variants

GetProductIdBySkuAsync

What it does: Searches Shopify for a product with the given SKU and returns its numeric product ID.

Signature: Task<string> GetProductIdBySkuAsync(string sku)

How to call it: await GetProductIdBySkuAsync(sku)

Parameter

Type

Required

Default

Description

sku

string

Yes

N/A

The SKU to search for in Shopify.

Returns: string. The Shopify product ID, or null when the SKU is blank or no product matches.

When to use it: Use it when a SKU is expected to exist at the product level.

GetVariantIdBySkuAsync

What it does: Searches Shopify for a product variant with the given SKU and returns its numeric variant ID. Most SKUs in Shopify live at the variant level.

Signature: Task<string> GetVariantIdBySkuAsync(string sku)

How to call it: await GetVariantIdBySkuAsync(sku)

Parameter

Type

Required

Default

Description

sku

string

Yes

N/A

The SKU to search for in Shopify.

Returns: string. The Shopify variant ID, or null when the SKU is blank or no variant matches.

When to use it: Use it when a SKU is expected to exist at the variant level.

GetProductOrVariantIdBySkuAsync

What it does: Resolves a SKU to a Shopify ID, checking the product level first and falling back to the variant level.

Signature: Task<string> GetProductOrVariantIdBySkuAsync(string sku)

How to call it: await GetProductOrVariantIdBySkuAsync(sku)

Parameter

Type

Required

Default

Description

sku

string

Yes

N/A

The SKU to search for in Shopify.

Returns: string. The Shopify product or variant ID, or null when the SKU is blank or neither matches.

When to use it: Use it when a SKU could belong to either a product or a variant and you want whichever exists.

ProductSkuCountAsync

What it does: Returns the number of Shopify product variants that match a product SKU.

Signature: Task<Int32> ProductSkuCountAsync(String productSku)

How to call it: await ProductSkuCountAsync(productSku)

Parameter

Type

Required

Default

Description

productSku

String

Yes

N/A

The SKU to search for in Shopify.

Returns: Int32. The number of matching product variants.

When to use it: Use it to check whether a SKU already exists in Shopify before assigning it.

ValidateProductSkuCountAsync

What it does: Returns whether a product SKU is unique in Shopify: true when no variant uses it, false when one or more do.

Signature: Task<Boolean> ValidateProductSkuCountAsync(String productSku)

How to call it: await ValidateProductSkuCountAsync(productSku)

Parameter

Type

Required

Default

Description

productSku

String

Yes

N/A

The SKU to check against existing Shopify product variants.

Returns: Boolean. True when the SKU is available (no matches); false when it already exists.

When to use it: Use it to prevent duplicate SKUs when creating or updating a product.

VariantSkuCountAsync

What it does: Returns the number of Shopify product variants that match a variant SKU.

Signature: Task<Int32> VariantSkuCountAsync(String variantSku)

How to call it: await VariantSkuCountAsync(variantSku)

Parameter

Type

Required

Default

Description

variantSku

String

Yes

N/A

The variant SKU to search for in Shopify.

Returns: Int32. The number of matching product variants.

When to use it: Use it to check whether a variant SKU already exists in Shopify.

ValidateVariantSkuCountAsync

What it does: Returns whether a variant SKU is unique in Shopify: true when unused, false when one or more variants use it.

Signature: Task<Boolean> ValidateVariantSkuCountAsync(String variantSku)

How to call it: await ValidateVariantSkuCountAsync(variantSku)

Parameter

Type

Required

Default

Description

variantSku

String

Yes

N/A

The variant SKU to check against existing Shopify variants.

Returns: Boolean. True when the SKU is available (no matches); false when it already exists.

When to use it: Use it to prevent duplicate variant SKUs when creating or importing variants.

ProductSkuIdsAsync

What it does: Returns the Shopify variant IDs of all variants that match a product SKU.

Signature: Task<List<string>> ProductSkuIdsAsync(string productSku)

How to call it: await ProductSkuIdsAsync(productSku)

Parameter

Type

Required

Default

Description

productSku

string

Yes

N/A

The SKU to search for in Shopify.

Returns: List<string>. The variant IDs matching the SKU.

When to use it: Use it to retrieve every Shopify variant ID linked to a SKU, for example when syncing or validating product data.

VariantSkuIdsAsync

What it does: Returns the Shopify variant IDs of all variants that match a variant SKU.

Signature: Task<List<string>> VariantSkuIdsAsync(string variantSku)

How to call it: await VariantSkuIdsAsync(variantSku)

Parameter

Type

Required

Default

Description

variantSku

string

Yes

N/A

The variant SKU to search for in Shopify.

Returns: List<string>. The variant IDs matching the SKU.

When to use it: Use it for variant-level SKU lookups during product synchronization or validation.

GetIPaaSTrackingMethodType

What it does: Returns whether a Shopify product should be tracked as a Product or a Variant. A product with a single variant and a single default option named Title is treated as a Product; otherwise it is a Variant.

Signature: string GetIPaaSTrackingMethodType(List<ProductVariant> variants, List<ProductOption> options)

How to call it: GetIPaaSTrackingMethodType(variants, options)

Parameter

Type

Required

Default

Description

variants

List<ProductVariant>

Yes

N/A

The Shopify product's variants.

options

List<ProductOption>

Yes

N/A

The Shopify product's options (for example Size, Color).

Returns: string. Product or Variant.

When to use it: Use it to decide whether inventory and tracking should occur at the product or variant level.

GetIPaaSProductType

What it does: Returns whether a product is Physical or Virtual, based on whether the first variant tracks inventory. No variants, or inventory tracking enabled, means Physical; inventory tracking disabled means Virtual.

Signature: string GetIPaaSProductType(List<ProductVariant> variants)

How to call it: GetIPaaSProductType(variants)

Parameter

Type

Required

Default

Description

variants

List<ProductVariant>

Yes

N/A

The Shopify product's variants, including inventory tracking details.

Returns: string. Physical or Virtual.

When to use it: Use it to classify a product so that virtual items (for example digital goods) are not inventory tracked.

SetVariantOptionAndValues

What it does: Converts a list of variant option name and value pairs into the Shopify variant option input format.

Signature: List<VariantOptionValueInput> SetVariantOptionAndValues(object iPaaSVariantOptionAndValues)

How to call it: SetVariantOptionAndValues(iPaaSVariantOptionAndValues)

Parameter

Type

Required

Default

Description

iPaaSVariantOptionAndValues

object

Yes

N/A

The variant option name and value pairs to convert.

Returns: List<VariantOptionValueInput>. The converted variant options, or null when the input is empty.

When to use it: Use it to format variant option data into the structure Shopify expects.

Categories and channels

ConvertCategoriesToShopifyIds

What it does: Converts a product's iPaaS.com categories into the matching Shopify category IDs, using the iPaaS.com mapping. Categories that do not already exist in Shopify are skipped, and duplicates are removed.

Signature: List<long> ConvertCategoriesToShopifyIds(object categories)

How to call it: ConvertCategoriesToShopifyIds(categories)

Parameter

Type

Required

Default

Description

categories

object

Yes

N/A

The iPaaS.com categories assigned to a product.

Returns: List<long>. The matching Shopify category IDs.

When to use it: Use it in product flows to map a product's iPaaS.com categories to Shopify category IDs.

ConvertShopifyProductCategoriesToiPaaS

What it does: Converts a list of Shopify product category IDs into iPaaS.com product category objects, using the iPaaS.com mapping. IDs without a mapping are skipped.

Signature: Task<object> ConvertShopifyProductCategoriesToiPaaS(object categories)

How to call it: await ConvertShopifyProductCategoriesToiPaaS(categories)

Parameter

Type

Required

Default

Description

categories

object

Yes

N/A

The Shopify product category IDs to convert.

Returns: object. A list of iPaaS.com product category objects carrying the mapped category IDs, or null when there is no input or no match.

When to use it: Use it in To iPaaS.com product flows to map Shopify product categories to their iPaaS.com equivalents.

GetChannelIdsByNames

What it does: Returns the Shopify sales channel IDs for a comma-separated list of channel names, matched case-insensitively.

Signature: Task<List<string>> GetChannelIdsByNames(object names)

How to call it: await GetChannelIdsByNames(names)

Parameter

Type

Required

Default

Description

names

object

Yes

N/A

A comma-separated list of Shopify channel names (for example Online Store,Point Of Sale).

Returns: List<string>. The matching channel IDs, or null when none match.

When to use it: Use it to assign products or orders to specific Shopify sales channels by name.

GetChannelNamesByIds

What it does: Returns the Shopify sales channel names for a list of channel IDs, as a comma-separated string.

Signature: Task<string> GetChannelNamesByIds(object channelIds)

How to call it: await GetChannelNamesByIds(channelIds)

Parameter

Type

Required

Default

Description

channelIds

object

Yes

N/A

The Shopify channel IDs to resolve to names.

Returns: string. The matching channel names joined by commas, or null when none match.

When to use it: Use it for a reverse lookup, turning stored Shopify channel IDs back into readable names.

Orders and gift cards

RequiresGiftCardTicket

What it does: Returns whether an order includes at least one gift card line item.

Signature: bool RequiresGiftCardTicket(List<LineItem> lineItems)

How to call it: RequiresGiftCardTicket(lineItems)

Parameter

Type

Required

Default

Description

lineItems

List<LineItem>

Yes

N/A

The order's line items.

Returns: bool. True when any line item is a gift card; otherwise false.

When to use it: Use it to trigger a gift card ticket workflow for orders that contain gift cards.

RequiresDepositTicket

What it does: Returns whether an order includes at least one non-gift-card line item, so a gift-card-only order does not require a deposit ticket.

Signature: bool RequiresDepositTicket(List<LineItem> lineItems)

How to call it: RequiresDepositTicket(lineItems)

Parameter

Type

Required

Default

Description

lineItems

List<LineItem>

Yes

N/A

The order's line items.

Returns: bool. True when any line item is not a gift card; otherwise false.

When to use it: Use it to decide whether a deposit ticket should be generated for an order.

ProductSoldTotal

What it does: Sums price times quantity for the non-gift-card line items in an order.

Signature: decimal ProductSoldTotal(List<LineItem> lineItems)

How to call it: ProductSoldTotal(lineItems)

Parameter

Type

Required

Default

Description

lineItems

List<LineItem>

Yes

N/A

The order's line items.

Returns: decimal. The total sales amount of the non-gift-card items, or 0 when there are none.

When to use it: Use it to compute revenue from non-gift-card products in an order.

ProductSoldCount

What it does: Sums the quantity of the non-gift-card line items in an order.

Signature: decimal ProductSoldCount(List<LineItem> lineItems)

How to call it: ProductSoldCount(lineItems)

Parameter

Type

Required

Default

Description

lineItems

List<LineItem>

Yes

N/A

The order's line items.

Returns: decimal. The total quantity of the non-gift-card items, or 0 when there are none.

When to use it: Use it to count non-gift-card products sold in an order.

GiftCardSoldTotal

What it does: Sums price times quantity for the gift card line items in an order.

Signature: decimal GiftCardSoldTotal(List<LineItem> lineItems)

How to call it: GiftCardSoldTotal(lineItems)

Parameter

Type

Required

Default

Description

lineItems

List<LineItem>

Yes

N/A

The order's line items.

Returns: decimal. The total gift card sales amount, or 0 when there are none.

When to use it: Use it to compute revenue from gift card sales in an order.

GiftCardSoldCount

What it does: Sums the quantity of the gift card line items in an order.

Signature: decimal GiftCardSoldCount(List<LineItem> lineItems)

How to call it: GiftCardSoldCount(lineItems)

Parameter

Type

Required

Default

Description

lineItems

List<LineItem>

Yes

N/A

The order's line items.

Returns: decimal. The total quantity of gift cards sold, or 0 when there are none.

When to use it: Use it to count gift cards sold in an order.

GetGiftCardIdFromLineItem

What it does: Returns the Shopify gift card ID for a line item, found in the order's fulfillment receipts. Any suffix on the line item ID is stripped before matching.

Signature: long? GetGiftCardIdFromLineItem(Order order, string lineItemId)

How to call it: GetGiftCardIdFromLineItem(order, lineItemId)

Parameter

Type

Required

Default

Description

order

Order

Yes

N/A

The Shopify order, including its fulfillment data.

lineItemId

string

Yes

N/A

The line item to find a gift card for. Any suffix is stripped before matching.

Returns: long?. The gift card ID, or null when none matches.

When to use it: Use it when a gift card ID is available only in the order's fulfillment receipts rather than on the line item.

IpaasGiftCardIdAsync

What it does: Resolves a Shopify gift card ID to its matching iPaaS.com gift card ID, using the iPaaS.com mapping.

Signature: Task<string> IpaasGiftCardIdAsync(long id)

How to call it: await IpaasGiftCardIdAsync(id)

Parameter

Type

Required

Default

Description

id

long

Yes

N/A

The Shopify gift card ID to resolve.

Returns: string. The matching iPaaS.com gift card ID.

When to use it: Use it to map a Shopify gift card to its iPaaS.com record when synchronizing gift cards.

ShopifyItemsAsync

What it does: Parses a comma-separated list of iPaaS.com line item IDs with quantities and returns line items whose IDs are the matching Shopify (external) IDs from the iPaaS.com mapping. Line items that cannot be mapped are skipped.

Signature: Task<List<LineItem>> ShopifyItemsAsync(object lineItemsRequest)

How to call it: await ShopifyItemsAsync(lineItemsRequest)

Parameter

Type

Required

Default

Description

lineItemsRequest

object

Yes

N/A

The line items as lineItemId-quantity pairs separated by commas, for example 12345-2,67890-1.

Returns: List<LineItem>. The line items with their mapped Shopify IDs and quantities.

When to use it: Use it to turn a list of iPaaS.com line item IDs and quantities into Shopify line items.

CreditCardAuthIsCaptured

What it does: Returns whether a credit card authorization has a successful capture, by looking for a matching capture transaction in the order's transactions.

Signature: bool CreditCardAuthIsCaptured(string authorization, List<Transaction> transactions)

How to call it: CreditCardAuthIsCaptured(authorization, transactions)

Parameter

Type

Required

Default

Description

authorization

string

Yes

N/A

The authorization code to check.

transactions

List<Transaction>

Yes

N/A

The order's transactions to search.

Returns: bool. True when a successful capture exists for the authorization; otherwise false.

When to use it: Use it to confirm a payment authorization has been captured. It raises an error when the transactions are missing or the authorization code is not found.

Fulfillments and returns

GetGiftCardFulfillmentCount

What it does: Returns the total number of gift card records across an order's fulfillments.

Signature: int GetGiftCardFulfillmentCount(List<Fulfillment> fulfillments)

How to call it: GetGiftCardFulfillmentCount(fulfillments)

Parameter

Type

Required

Default

Description

fulfillments

List<Fulfillment>

Yes

N/A

The order's fulfillments.

Returns: int. The number of gift card records; 0 when there are none.

When to use it: Use it to count how many gift cards were fulfilled on an order.

GetGiftCardIdFromFullfillment

What it does: Returns the Shopify gift card ID for a line item, found in a list of fulfillment receipts. A -GC suffix on the line item ID is removed before matching.

Signature: long? GetGiftCardIdFromFullfillment(List<Fulfillment> fulfillments, string lineItemId)

How to call it: GetGiftCardIdFromFullfillment(fulfillments, lineItemId)

Parameter

Type

Required

Default

Description

fulfillments

List<Fulfillment>

Yes

N/A

The order's fulfillments.

lineItemId

string

Yes

N/A

The line item to find a gift card for. A -GC suffix is removed before matching.

Returns: long?. The gift card ID, or null when none matches.

When to use it: Use it as a fallback when GetGiftCardIdFromLineItem returns null.

HasFulfillmentLineItemForSkuAsync

What it does: Returns whether a SKU appears among a Shopify order's fulfillment line items.

Signature: Task<bool> HasFulfillmentLineItemForSkuAsync(string orderId, string sku)

How to call it: await HasFulfillmentLineItemForSkuAsync(orderId, sku)

Parameter

Type

Required

Default

Description

orderId

string

Yes

N/A

The Shopify order ID to check.

sku

string

Yes

N/A

The SKU to look for among the order's fulfillment line items.

Returns: bool. True when the SKU has a fulfillment line item on the order; otherwise false.

When to use it: Use it in a return mapping filter to exclude a return line whose SKU is not on the referenced order.

ShopifyOrderExistAndFulfilled

What it does: Returns whether a Shopify order exists and has been fully fulfilled.

Signature: Task<bool> ShopifyOrderExistAndFulfilled(string orderId)

How to call it: await ShopifyOrderExistAndFulfilled(orderId)

Parameter

Type

Required

Default

Description

orderId

string

Yes

N/A

The Shopify order ID to verify.

Returns: bool. True when the order exists and is fully fulfilled; otherwise false.

When to use it: Use it to gate return creation so a return is not attempted against a missing or unfulfilled order.

GetCustomerIdByOrderIdAsync

What it does: Returns the Shopify customer ID associated with an order.

Signature: Task<string> GetCustomerIdByOrderIdAsync(string orderId)

How to call it: await GetCustomerIdByOrderIdAsync(orderId)

Parameter

Type

Required

Default

Description

orderId

string

Yes

N/A

The Shopify order ID to look up the customer for.

Returns: string. The Shopify customer ID, or null when the order is blank or has no customer.

When to use it: Use it to resolve the customer tied to an order, for example when linking a return or transaction back to its customer.

GetEmailByOrderIdAsync

What it does: Returns the email address associated with a Shopify order.

Signature: Task<string> GetEmailByOrderIdAsync(string orderId)

How to call it: await GetEmailByOrderIdAsync(orderId)

Parameter

Type

Required

Default

Description

orderId

string

Yes

N/A

The Shopify order ID to look up the email for.

Returns: string. The order's email address, or null when the order is blank or has no email.

When to use it: Use it to populate an email field on a return or transaction from its originating order.

Customers

CustomerTagsToiPaaSCategories

What it does: Converts a list of Shopify customer tags into iPaaS.com customer category objects, resolving each tag to its iPaaS.com category and fetching the category data.

Signature: Task<object> CustomerTagsToiPaaSCategories(List<string> Tags)

How to call it: await CustomerTagsToiPaaSCategories(Tags)

Parameter

Type

Required

Default

Description

Tags

List<string>

Yes

N/A

The Shopify customer tags to convert.

Returns: object. A list of iPaaS.com customer category objects, or null when the input is empty or none resolve.

When to use it: Use it in To iPaaS.com customer flows to map Shopify customer tags to iPaaS.com categories.

CustomerCategoriesToTags

What it does: Converts iPaaS.com customer category objects into a list of tag names (the category names).

Signature: List<string> CustomerCategoriesToTags(object iPaaSCategories)

How to call it: CustomerCategoriesToTags(iPaaSCategories)

Parameter

Type

Required

Default

Description

iPaaSCategories

object

Yes

N/A

The iPaaS.com customer categories to convert.

Returns: List<string>. The category names as tags, or null when the input is empty.

When to use it: Use it to map iPaaS.com customer categories back to Shopify customer tags.

Metafields, media, and custom fields

GetValueFromMetaFields

What it does: Returns the value of a Shopify metafield from a list, matched by key or by namespace and key (using dot notation namespace.key). Matching is case-insensitive.

Signature: object GetValueFromMetaFields(List<MetafieldInput> metaFieldObj, string textFieldName)

How to call it: GetValueFromMetaFields(metaFieldObj, textFieldName)

Parameter

Type

Required

Default

Description

metaFieldObj

List<MetafieldInput>

Yes

N/A

The Shopify metafields to search.

textFieldName

string

Yes

N/A

The metafield key, or namespace.key. Matching is case-insensitive. Do not pass the metafield's display name.

Returns: object. The metafield's value, or null when it is not found.

Example: custom.meta_color matches the metafield whose namespace is custom and key is meta_color.

When to use it: Use it to read a Shopify metafield value from a product, variant, or other metafield collection.

GetImageDataFromMedia

What it does: Builds a string of image records from a Shopify media object. Each record is imageId;url;altText, and records are separated by a pipe (|). When UrlOnly is true, each record is just the URL.

Signature: string GetImageDataFromMedia(MediaEdges Media, bool UrlOnly = false)

How to call it: GetImageDataFromMedia(Media)

Parameter

Type

Required

Default

Description

Media

MediaEdges

Yes

N/A

The Shopify media object containing the image data.

UrlOnly

bool

No

false

When true, includes only the image URLs; otherwise includes the image ID, URL, and alt text.

Returns: string. The formatted image records, or null when there is no media.

When to use it: Use it to aggregate a product's image data into a single string for a destination field or feed.

GetValueFromCustomField

What it does: Returns the value of a named custom field from a custom fields object, keeping the value's original type. It returns null when the field is not present.

Signature: object GetValueFromCustomField(object customFieldObj, object textFieldName)

How to call it: GetValueFromCustomField(customFieldObj, textFieldName)

Parameter

Type

Required

Default

Description

customFieldObj

object

Yes

N/A

The object containing the custom fields.

textFieldName

object

Yes

N/A

The name of the custom field to read.

Returns: object. The custom field's value in its original type, or null when the field is not found.

Example: reading Active_Web_User returns its value (for example Yes).

When to use it: Use it to pull a single custom field value into a destination field.

ValueJsonEncode

What it does: Escapes a string so it can be safely embedded in JSON or a GraphQL query.

Signature: string ValueJsonEncode(string input)

How to call it: ValueJsonEncode(input)

Parameter

Type

Required

Default

Description

input

string

Yes

N/A

The raw string to escape.

Returns: string. The JSON-escaped string.

When to use it: Use it to safely insert dynamic string content into JSON or GraphQL, avoiding syntax or injection issues.

Related Documents

Did this answer your question?