Skip to main content

Adobe Commerce/Magento 2 Mapping Functions

Reference for the Adobe Commerce/Magento 2 functions you can use in Dynamic Formula mappings and mapping collection filters.

Overview

The Adobe Commerce/Magento 2 integration provides ready-made functions you can call when building mappings. They handle common lookups and conversions against your Magento store and your iPaaS.com data, such as resolving products, customers, companies, stores, and regions to their Magento IDs, cleaning attribute codes and URL keys, formatting SKUs, matching order line items, and totaling order and gift card sales, 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 Adobe Commerce/Magento 2 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 GetProductBySku(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.

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

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

Products and attributes

GetProductBySku

What it does: Confirms a product exists in Magento by its SKU and returns that SKU when a match is found.

Signature: Task<string> GetProductBySku(string sku)

How to call it: await GetProductBySku(sku)

Parameter

Type

Required

Default

Description

sku

string

Yes

N/A

The product SKU to search for in Magento.

Returns: string. The product's SKU when a matching product exists, or null when the SKU is blank or no product matches.

Example: ABC123 returns ABC123 when a product with that SKU exists, and null when none does.

When to use it: Use it to confirm a product exists in Magento before syncing data or creating related records.

ConvertCategoriesToMagentoIdsAsync

What it does: Converts a product's iPaaS.com category assignments into the matching Magento category IDs, using the iPaaS.com mapping. Categories without a valid mapping are skipped, and duplicates are removed.

Signature: Task<List<int>> ConvertCategoriesToMagentoIdsAsync(object categories)

How to call it: await ConvertCategoriesToMagentoIdsAsync(categories)

Parameter

Type

Required

Default

Description

categories

object

Yes

N/A

The iPaaS.com category assignments to convert.

Returns: List<int>. The matching Magento category IDs; an empty list when none resolve.

Example: iPaaS.com categories 3908 and 1234 return the matching Magento category IDs, for example 101 and 202. Categories with no mapping are skipped.

When to use it: Use it when assigning a product's categories in Magento, to turn iPaaS.com categories into Magento category IDs.

GetCustomValue

What it does: Returns the value of a named custom field from a list of custom fields, in lowercase. The field name is matched case-insensitively.

Signature: string GetCustomValue(List<GenericCustomFieldResponse> customFields, string fieldName)

How to call it: GetCustomValue(customFields, fieldName)

Parameter

Type

Required

Default

Description

customFields

List<GenericCustomFieldResponse>

Yes

N/A

The custom fields to search.

fieldName

string

Yes

N/A

The name of the custom field to read. Matching is case-insensitive.

Returns: string. The custom field's value in lowercase, or null when the list is empty or no field matches.

Example: reading the custom field email returns its value in lowercase, for example user@example.com, or null when the field is not present.

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

SkuFromOrderLine

What it does: Returns the base SKU from an order-line SKU, dropping any metadata appended after the last caret (^).

Signature: string SkuFromOrderLine(string sku)

How to call it: SkuFromOrderLine(sku)

Parameter

Type

Required

Default

Description

sku

string

Yes

N/A

The full SKU, which may include extra metadata after a caret.

Returns: string. The base SKU, or an empty string when the input is null or empty.

Example: ABC123^ExtraData returns ABC123.

When to use it: Use it to get the base SKU from an order-line SKU that carries appended metadata.

UnitFromSku

What it does: Returns the metadata (for example the unit) that appears after the last caret (^) in a SKU.

Signature: string UnitFromSku(string sku)

How to call it: UnitFromSku(sku)

Parameter

Type

Required

Default

Description

sku

string

Yes

N/A

The full SKU, which may include a unit or metadata after a caret.

Returns: string. The portion after the last caret, or an empty string when there is none.

Example: ABC123^Box returns Box.

When to use it: Use it to read the unit or metadata appended to a SKU.

CleanProductAttributeCode

What it does: Normalizes a product attribute code to Magento's rules: lowercases it and removes any character that is not a letter, digit, or underscore.

Signature: string CleanProductAttributeCode(string attributeCode)

How to call it: CleanProductAttributeCode(attributeCode)

Parameter

Type

Required

Default

Description

attributeCode

string

Yes

N/A

The raw attribute code to clean.

Returns: string. The cleaned attribute code, containing only letters, digits, and underscores. Magento also requires the first character to be a letter and a maximum length of 60 characters.

Example: Color Size/Type! returns colorsizetype.

When to use it: Use it to normalize a product attribute code before sending it to Magento.

CleanAttribute

What it does: Sanitizes a product attribute value for Magento by converting reserved and special characters to safe HTML entities (for example the ampersand, greater-than, quotation marks, and trademark and registered marks) and replacing unsupported symbols, keeping only allowed characters.

Signature: string CleanAttribute(string input)

How to call it: CleanAttribute(input)

Parameter

Type

Required

Default

Description

input

string

Yes

N/A

The raw attribute value to sanitize.

Returns: string. The sanitized value.

Example: an attribute value carrying a trademark symbol, a long dash and an ellipsis comes back with those characters replaced by plain equivalents.

When to use it: Use it to sanitize a product attribute value before sending it to Magento.

CleanUrlKey

What it does: Normalizes a URL key by replacing underscores, spaces, and slashes with hyphens and lowercasing the result.

Signature: string CleanUrlKey(string url_key)

How to call it: CleanUrlKey(url_key)

Parameter

Type

Required

Default

Description

url_key

string

Yes

N/A

The raw URL key to clean.

Returns: string. The cleaned, URL-friendly key.

Example: Summer_Collection 2025/Deals returns summer-collection-2025-deals.

When to use it: Use it to produce a URL-friendly key before saving it to Magento.

ChildBarcodeOverrideField

What it does: Builds a formatted string that wraps an attribute name in square brackets and appends a barcode override value.

Signature: string ChildBarcodeOverrideField(string attributeName, string barcodeOverride)

How to call it: ChildBarcodeOverrideField(attributeName, barcodeOverride)

Parameter

Type

Required

Default

Description

attributeName

string

Yes

N/A

The attribute name to wrap in square brackets.

barcodeOverride

string

Yes

N/A

The override barcode value to append after the attribute name.

Returns: string. The combined string.

Example: attribute Color and override 12345 returns [Color]12345.

When to use it: Use it to build a child product's barcode override field from an attribute name and a barcode value.

ToTitleCase

What it does: Converts a string to title case using US English rules, capitalizing the first letter of each word.

Signature: string ToTitleCase(string input)

How to call it: ToTitleCase(input)

Parameter

Type

Required

Default

Description

input

string

Yes

N/A

The text to convert to title case.

Returns: string. The title-cased text. Words that are entirely uppercase are treated as acronyms and left unchanged.

Example: hello world returns Hello World.

When to use it: Use it to normalize casing, for example when formatting names or titles.

Orders, shipments, and gift cards

GetOrderIdByOrderNumber

What it does: Returns the Magento internal order ID (entity ID) for a given order number (increment ID).

Signature: Task<string?> GetOrderIdByOrderNumber(string orderNumber)

How to call it: await GetOrderIdByOrderNumber(orderNumber)

Parameter

Type

Required

Default

Description

orderNumber

string

Yes

N/A

The Magento order number (increment ID) to look up, for example 100000123.

Returns: string?. The Magento order entity ID, or null when the order number is blank or no order matches.

Example: the order number 100000123 returns that order's Magento ID.

When to use it: Use it to resolve a Magento internal order ID from an order number.

GetLineItemIdByOrderIdSku

What it does: Returns the Magento order line item ID for a SKU on an order. It first checks the iPaaS.com transaction for a unit custom field and, when present, appends the unit to the SKU (as sku^unit) before matching. Only configurable and simple line items are considered.

Signature: Task<int> GetLineItemIdByOrderIdSku(string orderId, string sku, string iPaaSOrderId, string unitCustomFieldName)

How to call it: await GetLineItemIdByOrderIdSku(orderId, sku, iPaaSOrderId, unitCustomFieldName)

Parameter

Type

Required

Default

Description

orderId

string

Yes

N/A

The Magento order ID whose line items to search.

sku

string

Yes

N/A

The base SKU of the line item to find.

iPaaSOrderId

string

Yes

N/A

The iPaaS.com order (transaction) ID, used to look up the unit custom field.

unitCustomFieldName

string

Yes

N/A

The custom field whose value is appended to the SKU as a unit before matching.

Returns: int. The matching line item ID, or 0 when no line item matches.

Example: for Magento order 1001, SKU ABC123, iPaaS.com order IP-56789 and the unit custom field Unit, returns the ID of the matching line item on that order.

When to use it: Use it to find a Magento order's line item ID for a given SKU, including a unit-specific variant.

GetLineItemIdByOrderSku

What it does: For a set of shipment items (SKUs with quantities), returns a delimited string of Magento line item IDs with their quantities. It appends a unit custom field to each SKU when present, matches against the order's items, and uses the subscription's configured field and record delimiters.

Signature: Task<string> GetLineItemIdByOrderSku(string? orderId, string? shipmentItems, string? iPaaSOrderId, string? LineItemUnitCustomFieldName)

How to call it: await GetLineItemIdByOrderSku(orderId, shipmentItems, iPaaSOrderId, LineItemUnitCustomFieldName)

Parameter

Type

Required

Default

Description

orderId

string?

Yes

N/A

The Magento order ID whose line items to match.

shipmentItems

string?

Yes

N/A

The shipment SKUs and their quantities, separated by the subscription's configured field and record delimiters.

iPaaSOrderId

string?

Yes

N/A

The iPaaS.com transaction ID, used to look up the unit custom field for each SKU.

LineItemUnitCustomFieldName

string?

Yes

N/A

The custom field whose value is appended to each SKU as a unit before matching.

Returns: string. A delimited string of line item IDs and their quantities, or null when required inputs are missing or the delimiters are not configured.

Example: with the field delimiter | and record delimiter ,, a shipmentItems value of SKU1|2,SKU2|3 produces output like 12345|2,67890|1.

When to use it: Use it during shipment creation to map shipment SKUs and quantities to Magento order line items. It raises an error if not every shipment product can be found on the order.

GetFormattedSku

What it does: Appends a unit custom field value to a SKU (as sku^unit) when the matching iPaaS.com transaction line has that custom field with a value; otherwise it returns the original SKU.

Signature: Task<string> GetFormattedSku(string? sku, string? iPaaSOrderId, string? LineItemUnitCustomFieldName)

How to call it: await GetFormattedSku(sku, iPaaSOrderId, LineItemUnitCustomFieldName)

Parameter

Type

Required

Default

Description

sku

string?

Yes

N/A

The base SKU of the line item.

iPaaSOrderId

string?

Yes

N/A

The iPaaS.com transaction ID whose line to check for the unit custom field.

LineItemUnitCustomFieldName

string?

Yes

N/A

The custom field whose value is appended to the SKU when present.

Returns: string. The SKU with the unit appended (as sku^unit) when found, otherwise the original SKU.

Example: returns ABC123^Large when the unit custom field is Large, or ABC123 when there is no such value.

When to use it: Use it to differentiate a SKU by a unit or attribute value during order synchronization.

RequiresDepositTicket

What it does: Returns whether a Magento order requires a deposit ticket, which is true when the order has any invoiced amount, or includes a gift card or rewards-redemption payment.

Signature: bool RequiresDepositTicket(SalesDataOrderInterface order)

How to call it: RequiresDepositTicket(order)

Parameter

Type

Required

Default

Description

order

SalesDataOrderInterface

Yes

N/A

The Magento sales order, including its invoiced total and payments.

Returns: bool. True when the order has an invoiced amount or a gift card or rewards-redemption payment; otherwise false.

Example: an order with a total invoiced amount of 100.50 returns true, even when no gift card or rewards payment is involved.

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

RequiresGiftCardTicket

What it does: Returns whether a Magento order includes a gift card product (a product type of giftvoucher or amgiftcard).

Signature: bool RequiresGiftCardTicket(SalesDataOrderInterface order)

How to call it: RequiresGiftCardTicket(order)

Parameter

Type

Required

Default

Description

order

SalesDataOrderInterface

Yes

N/A

The Magento sales order, including its items.

Returns: bool. True when the order contains a gift card product; otherwise false.

Example: an order holding a gift card product returns true, and one holding none returns false.

When to use it: Use it to decide whether a gift card ticket is required for an order.

GiftCardSoldTotal

What it does: Sums the price of the top-level gift card products in an order (product type giftvoucher or amgiftcard, with no parent item).

Signature: decimal GiftCardSoldTotal(List<Models.Extensions.SalesDataOrderItemInterface> products_Data)

How to call it: GiftCardSoldTotal(products_Data)

Parameter

Type

Required

Default

Description

products_Data

List<Models.Extensions.SalesDataOrderItemInterface>

Yes

N/A

The order's items.

Returns: decimal. The total price of the gift card products, or 0 when there are none.

Example: gift card products priced 25 and 50 return 75, and an order with no gift cards returns 0.

When to use it: Use it to compute total gift card sales for an order.

ProductSoldTotal

What it does: Sums the price of the top-level non-gift-card products in an order (any product other than giftvoucher or amgiftcard, with no parent item).

Signature: decimal ProductSoldTotal(List<Models.Extensions.SalesDataOrderItemInterface> products_Data)

How to call it: ProductSoldTotal(products_Data)

Parameter

Type

Required

Default

Description

products_Data

List<Models.Extensions.SalesDataOrderItemInterface>

Yes

N/A

The order's items.

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

Example: non-gift-card products priced 30 and 45 return 75, and an order with none returns 0.

When to use it: Use it to compute total product sales (excluding gift cards) for an order.

GiftCardSoldCount

What it does: Sums the ordered quantity of the top-level gift card products in an order.

Signature: decimal GiftCardSoldCount(List<Models.Extensions.SalesDataOrderItemInterface> products_Data)

How to call it: GiftCardSoldCount(products_Data)

Parameter

Type

Required

Default

Description

products_Data

List<Models.Extensions.SalesDataOrderItemInterface>

Yes

N/A

The order's items.

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

Example: two gift cards on one line and three on another return 5, and an order with no gift cards returns 0.

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

ProductSoldCount

What it does: Sums the ordered quantity of the top-level non-gift-card products in an order.

Signature: decimal ProductSoldCount(List<Models.Extensions.SalesDataOrderItemInterface> products_Data)

How to call it: ProductSoldCount(products_Data)

Parameter

Type

Required

Default

Description

products_Data

List<Models.Extensions.SalesDataOrderItemInterface>

Yes

N/A

The order's items.

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

Example: non-gift-card lines ordering 2 and 3 units return 5, and an order with none returns 0.

When to use it: Use it to count how many products (excluding gift cards) were sold in an order.

iPaaSGiftCardIdAsync

What it does: Returns the iPaaS.com gift card ID for a given gift card number, using a case-insensitive number match.

Signature: Task<string> iPaaSGiftCardIdAsync(string gcnumber)

How to call it: await iPaaSGiftCardIdAsync(gcnumber)

Parameter

Type

Required

Default

Description

gcnumber

string

Yes

N/A

The gift card number to look up in iPaaS.com. Matching is case-insensitive.

Returns: string. The iPaaS.com gift card ID of the first match, or null when the number is blank or no match is found.

Example: the gift card number GC12345 returns the matching iPaaS.com gift card ID, for example 67890.

When to use it: Use it to resolve an iPaaS.com gift card ID from a gift card number.

Customers and companies

GetCustomerIdByEmail

What it does: Returns the Magento customer ID for a given email address.

Signature: Task<string> GetCustomerIdByEmail(string email)

How to call it: await GetCustomerIdByEmail(email)

Parameter

Type

Required

Default

Description

email

string

Yes

N/A

The customer email to search for in Magento.

Returns: string. The Magento customer ID, or null when the email is blank or no customer matches.

Example: john.doe@example.com returns that customer's Magento ID, for example 12345.

When to use it: Use it to resolve a Magento customer ID from an email address.

GetCategoryIdByName

What it does: Returns the Magento customer group ID for a given customer group code. Despite its name, this function looks up a customer group by its code, not a product category.

Signature: Task<string> GetCategoryIdByName(string Name)

How to call it: await GetCategoryIdByName(Name)

Parameter

Type

Required

Default

Description

Name

string

Yes

N/A

The Magento customer group code to search for.

Returns: string. The Magento customer group ID, or null when the code is blank or no group matches.

Example: the customer group code General returns that group's Magento ID, for example 1. Despite the name, this looks up a customer group rather than a category.

When to use it: Use it to resolve a Magento customer group ID from its code.

GetCompanyIdByName

What it does: Returns the Magento company ID for a given company name.

Signature: Task<string> GetCompanyIdByName(string Name)

How to call it: await GetCompanyIdByName(Name)

Parameter

Type

Required

Default

Description

Name

string

Yes

N/A

The Magento company name to search for.

Returns: string. The Magento company ID, or null when the name is blank or no company matches.

Example: ABC Corporation returns that company's Magento ID, for example 456.

When to use it: Use it to resolve a Magento company ID from a company name.

GetTaxIdByName

What it does: Returns the Magento customer tax class ID for a given tax class name. It matches on the class name, with the class type fixed to CUSTOMER.

Signature: Task<string> GetTaxIdByName(string taxName)

How to call it: await GetTaxIdByName(taxName)

Parameter

Type

Required

Default

Description

taxName

string

Yes

N/A

The Magento customer tax class name to look up (for example Retail, Wholesale).

Returns: string. The Magento tax class ID, or null when the name is blank or no class matches.

Example: Wholesale returns that tax class's Magento ID, for example 3.

When to use it: Use it to resolve a Magento customer tax class ID from its name.

IsValidSuperUserId

What it does: Returns whether a company has a valid super user. It is true when the company's super user maps to a Magento customer that is not already assigned to another company, or when only an iPaaS.com customer exists.

Signature: Task<object> IsValidSuperUserId(string companyId)

How to call it: await IsValidSuperUserId(companyId)

Parameter

Type

Required

Default

Description

companyId

string

Yes

N/A

The company ID to validate.

Returns: object. True when a valid super user is found; otherwise false.

Example: company 12345 returns true when it has a valid super user, and false when it has none or the lookup finds a conflict.

When to use it: Use it to confirm a company has a unique super user before further processing.

GetSuperUserId

What it does: Returns the Magento super user (customer) ID for a company, or 0 when no valid super user is found.

Signature: Task<object> GetSuperUserId(string companyId)

How to call it: await GetSuperUserId(companyId)

Parameter

Type

Required

Default

Description

companyId

string

Yes

N/A

The company ID whose super user ID you want.

Returns: object. The Magento super user ID, or 0 when none is found. It raises an error if the lookup fails.

Example: company 12345 returns that company's Magento super user ID, for example 67890, or 0 when it has none.

When to use it: Use it to fetch a company's super user ID.

ValidateCustomer

What it does: Validates a company's super user against both iPaaS.com and Magento and returns the result, including the iPaaS.com customer ID and the Magento customer ID. When the Magento customer is already assigned to another company, the Magento value is marked with an _Exists suffix.

Signature: Task<object> ValidateCustomer(string iPaaSCompanyid)

How to call it: await ValidateCustomer(iPaaSCompanyid)

Parameter

Type

Required

Default

Description

iPaaSCompanyid

string

Yes

N/A

The iPaaS.com company ID whose super user mapping is validated.

Returns: object. The validation result carrying the iPaaS.com and Magento customer IDs; the Magento value ends with _Exists when there is a conflict.

Example: the iPaaS.com company 98765 returns the matching iPaaS.com and Magento customer IDs. When the Magento customer is already mapped to a different company, the Magento value comes back with _Exists appended, for example 67890_Exists.

When to use it: This is the validation used by IsValidSuperUserId and GetSuperUserId. Use those unless you need the full result.

Stores and websites

GetStoreIdByName

What it does: Returns the Magento store ID for a given store name.

Signature: Task<long> GetStoreIdByName(string name)

How to call it: await GetStoreIdByName(name)

Parameter

Type

Required

Default

Description

name

string

Yes

N/A

The Magento store name to look up.

Returns: long. The Magento store ID, or 0 when the name is blank.

Example: Main Store returns that store's Magento ID, for example 1.

When to use it: Use it to resolve a Magento store ID from its name.

GetWebsiteIdsByNames

What it does: Returns the Magento website IDs that match a set of website names, matched case-insensitively. Names that do not match are skipped.

Signature: Task<List<int>> GetWebsiteIdsByNames(object websiteNamesObj)

How to call it: await GetWebsiteIdsByNames(websiteNamesObj)

Parameter

Type

Required

Default

Description

websiteNamesObj

object

Yes

N/A

The website names to resolve (a list of names).

Returns: List<int>. The matching Magento website IDs, or null when no names are provided.

Example: the names Main Website and B2B Store return the matching Magento website IDs, for example 1 and 3. A name that matches nothing is skipped.

When to use it: Use it to resolve a set of Magento website IDs from their names.

Addresses and locations

GetStreetAddress

What it does: Builds a street address as a list of lines from up to three address components. Address1 is its own line; Address2 and Address3 are combined into a single line separated by a pipe when both are present.

Signature: List<string> GetStreetAddress(string Address1, string Address2, string Address3)

How to call it: GetStreetAddress(Address1, Address2, Address3)

Parameter

Type

Required

Default

Description

Address1

string

Yes

N/A

The first line of the street address.

Address2

string

Yes

N/A

The second line of the street address. Combined with Address3 when both are present.

Address3

string

Yes

N/A

The third line of the street address. Included only when Address2 is present.

Returns: List<string>. The non-empty address lines; an empty list when all inputs are empty.

Example: for 123 Main St, Apt 4B, and Building C, it returns two lines: 123 Main St and Apt 4B|Building C.

When to use it: Use it to prepare street address lines for a system that expects a list of strings.

GetCountryCode

What it does: Validates a country name or code and returns the matching Magento country ID.

Signature: Task<string> GetCountryCode(string country)

How to call it: await GetCountryCode(country)

Parameter

Type

Required

Default

Description

country

string

Yes

N/A

The country name or code to validate against Magento.

Returns: string. The Magento country ID, or null when the input is blank or no valid country is found.

Example: US returns the matching Magento country ID, or null when the country is not recognized.

When to use it: Use it to validate and resolve a country into a Magento country ID.

GetRegionByCountryCode

What it does: Returns the region data (ID, code, and name) for a region within a country, matched by any of the region ID, code, or name. At least one region value must be provided.

Signature: Task<List<string>> GetRegionByCountryCode(string countryParameter, string regionParameterId, string regionParameterCode, string regionParameterName)

How to call it: await GetRegionByCountryCode(countryParameter, regionParameterId, regionParameterCode, regionParameterName)

Parameter

Type

Required

Default

Description

countryParameter

string

Yes

N/A

The country code the region belongs to.

regionParameterId

string

Yes

N/A

The region ID to match. Provide at least one of the region ID, code, or name.

regionParameterCode

string

Yes

N/A

The region code to match. Provide at least one of the region ID, code, or name.

regionParameterName

string

Yes

N/A

The region name to match. Provide at least one of the region ID, code, or name.

Returns: List<string>. The region data (for example the ID, code, and name), or null when the country is missing, no region value is provided, or no region matches.

Example: country US with region ID 12 returns that region's data, for example the ID 12, the code NY and the name New York.

When to use it: Use it to validate and read a region's data for an address.

GetRegionId

What it does: Returns the Magento region ID for a given region name, matched across countries case-insensitively.

Signature: Task<string> GetRegionId(string regionName)

How to call it: await GetRegionId(regionName)

Parameter

Type

Required

Default

Description

regionName

string

Yes

N/A

The region name to look up. Matching is case-insensitive.

Returns: string. The Magento region ID, or null when no region matches.

Example: California returns that region's Magento ID, for example 12.

When to use it: Use it to resolve a Magento region ID from a region name.

GetRegionIdUsingCountryCodeAndRegionNameOrCode

What it does: Returns the Magento region ID for a region within a country, matching the country by its two-letter code, three-letter code, or full English name, and the region by its code or name (case-insensitive).

Signature: Task<string> GetRegionIdUsingCountryCodeAndRegionNameOrCode(string countryCode, string regionNameOrCode)

How to call it: await GetRegionIdUsingCountryCodeAndRegionNameOrCode(countryCode, regionNameOrCode)

Parameter

Type

Required

Default

Description

countryCode

string

Yes

N/A

The country identifier: a two-letter code, three-letter code, or full English name.

regionNameOrCode

string

Yes

N/A

The region code or name to look up within the matched country. Matching is case-insensitive.

Returns: string. The Magento region ID, or null when no match is found.

Example: country US with the region CA returns that region's Magento ID, for example 12. The region can be given as either its code or its name.

When to use it: Use it to resolve a Magento region ID when you have both the country and the region.

GetRegionCodeUsingCountryCodeAndRegionNameOrCode

What it does: Returns the Magento region code for a region within a country, matching the country by its two-letter code, three-letter code, or full English name, and the region by its code or name (case-insensitive).

Signature: Task<string> GetRegionCodeUsingCountryCodeAndRegionNameOrCode(string countryCode, string regionNameOrCode)

How to call it: await GetRegionCodeUsingCountryCodeAndRegionNameOrCode(countryCode, regionNameOrCode)

Parameter

Type

Required

Default

Description

countryCode

string

Yes

N/A

The country identifier: a two-letter code, three-letter code, or full English name.

regionNameOrCode

string

Yes

N/A

The region code or name to look up within the matched country. Matching is case-insensitive.

Returns: string. The Magento region code, or null when no match is found.

Example: country US with the region California returns that region's Magento code, CA.

When to use it: Use it to resolve a Magento region code when you have both the country and the region.

Related Documents

Did this answer your question?