Mappings
Last updated
Was this helpful?
Last updated
Was this helpful?
This feature gives you full control of mapping rules so that you can better utilise the data that's available in the ERP. You can configure certain product attributes in the ERP and enrich them further for Shopify. For example, combine title and colour together to create Shopify product titles.
"Mappings" are templates and rules linked to specific Shopify attributes. DotDev will set up these mappings for you based on your preferences, but you can also update them yourself.
To access the mappings, go to Products > Mappings
. Here, you'll see a list of Shopify attributes and their associated mappings. For example, you can map ERP references to Shopify tags, as shown in the screenshot.
Each mapping contains one or more “rules”. When the DotApparel app is calculating the value of a particular Shopify attribute, it will first find any mappings attached to that field, and then for each mapping, loop over the rules until one evaluates to true.
In the screenshot above, we can see that the rule will only evaluate to true if the references.category.name
attribute on the product is not empty.
For the first rule which evaluates to true, the attached template will be applied, and no further rules within that mapping will be executed.
Rules are a powerful way of changing the value of attributes in Shopify based on a series of conditions in ERP, and can be used for a huge array of purposes. Here are some examples of how you could use rules in your mappings.
Only add a category tag when the category reference is not empty in ERP
Add a category:tops
tag, when the category
reference in ERP is set to “shirts”, or “t-shirts”, allowing you to create a universal “tops” collection in Shopify
Append - Clearance
to the product title if the clearance
reference is set to Yes
DotApparel provides some powerful template functions to allow users to perform string manipulation tasks. From simple transformations like changing case or truncating strings to more complex operations like translating text or matching patterns, these helpers are here to make your development process smoother.
Explore the functions described in the following sections to discover how they can aid in your specific use case, and feel free to incorporate them into your templates as needed.
slugify
This function transforms any given string into a URL-friendly version, removing any special characters and spaces. It's particularly useful for creating slugs for URLs in web applications.
{{#slugify}}STRING{{/slugify}}
Given the AP21 field notes > web-care-label and you want to slugify it.
web-care-label: "Cold hand wash separately"
This is how the template function would look like
{{#slugify}}{{notes.web-care-label}}{{/slugify}}
Cold hand wash separately
stripTags
Removes all HTML tags and CSS rules from the given input string. It can be useful in scenarios where you want to present pure textual data, stripping out any styling or scripting elements.
{{#stripTags}}STRING{{/stripTags}}
Given the AP21 field notes > web-care-label and you want to remove HTML tags and CSS it.
This is how the template function would look like
{{#stripTags}}{{notes.web-care-label}}{{/stripTags}}
remove
This function facilitates the removal of specific substrings from a given text. It can be applied when you need to find and remove certain patterns or words from a text string.
{{#remove}}substring1::substring2::STRING{{/remove}}
Given the AP21 field notes > web-care-label and you want to remove the word "cold" and "hand".
web-care-label: "Cold hand wash separately"
This is how the template function would look like
{{#remove}}cold::hand::{{notes.web-care-label}}{{/remove}}
Cold hand wash separately
truncateStr
This function is used to shorten a string to a specified maximum length, cutting off characters from the right side. This might be useful for displaying previews of long texts.
{{#truncateStr}}sourceString::maxLength{{/truncateStr}}
Given the AP21 field notes > web-care-label and you want to truncate to 13 characters.
web-care-label: "Cold hand wash separately"
This is how the template function would look like
{{#truncateStr}}{{notes.web-care-label}}::13{{/truncateStr}}
Cold hand wash separately
truncateStrLeft
Similar to truncateStr
, the truncateStrLeft
function cuts off characters from the left side of the string up to a specified maximum length. It serves the purpose of displaying the ending part of long texts.
{{#truncateStrLeft}}sourceString::maxLength{{/truntruncateStrLeftate}}
{{#truncateStrLeft}}{{notes.web-care-label}}::13{{/truncateStrLeft}}
padStart
This function pads the beginning of a given string with another string until the resulting string reaches a specific length. It's handy for aligning texts or filling with specific characters, such as zeros.
{{#padStart}}sourceString::padString::targetLength{{/padStart}}
Example
Imagine you have an AP21 product code "K884"
and you need to ensure it always displays as an 8-character string, padding it with zeros at the beginning if necessary.
productCode: "K884"
This is how the template function would look like
{{#padstart}}{{productCode}}::0::8{{/padstart}}
K884
lowercase
The lowercase
function converts all characters in a given string to lowercase. It's useful for standardising text input or creating case-insensitive comparisons.
{{#lowercase}}STRING{{/lowercase}}
Given the AP21 field notes > web-care-label and you want to convert to lowercase.
web-care-label: "COLD HAND WASH SEPARATELY"
This is how the template function would look like
{{#remove}}{{notes.web-care-label}}{{/remove}}
COLD HAND WASH SEPARATELY
uppercase
Similar to lowercase
, this function transforms all characters in a string to uppercase. It's beneficial for emphasising text or handling case-insensitive processing.
{{#uppercase}}STRING{{/uppercase}}
Given the AP21 field notes > web-care-label and you want to convert to uppercase.
web-care-label: "cold hand wash separately"
This is how the template function would look like
{{#uppercase}}{{notes.web-care-label}}{{/uppercase}}
cold hand wash separately
titlecase
This function transforms the first letter of each word in the given string to uppercase and the rest to lowercase. It helps in formatting titles or headings in a standardized way.
{{#titlecase}}STRING{{/titlecase}}
Given the AP21 field notes > web-care-label and you want to transform the first letter of each word to uppercase.
web-care-label: "Cold hand wash separately"
This is how the template function would look like
{{#titlecase}}{{notes.web-care-label}}{{/titlecase}}
Cold hand wash separately
splitStr
This function breaks down a string into substrings using a specified separator and returns the substring at a given index. It's useful for parsing delimited data like CSV or user input.
{{#titlecase}}sourceString::separator::index{{/titlecase}}
Given the AP21 field notes > web-colour-details and and you want to split it by commas and retrieve the hex code which is represented on the second item (index 1 since indexing starts from 0)
web-colour-details: "Blue,#0000FF,BLU"
Behind the scenes when splitting,
This is how the template function would look like
{{#splitStr}}{{notes.web-colour-details}}::,::1{{/splitStr}}
Blue,#0000FF,BLU
match
This function finds all occurrences of a specified regular expression pattern in a string and returns the matched groups. It can be used for complex text parsing, data extraction, and validation scenarios.
{{#match}}regexPattern::sourceString{{/match}}
Given the Shopify order field note, and you want to extract the order number PO0001111
Regex pattern: PO #: (PO\d+)
This is how the template function would look like
{{#match}}PO #: (PO\d+)::{{note}}{{/match}}
"This is a purchase order. Purchase Order Details: - PO #: PO0001111 - fabric Marketplace Order ID: 11112222 - Shipping Method: Ground."
translate
The translate
function looks up a string in a predefined translation mapping and returns the corresponding translation.
{{#translate}}translation_table_id::attribute_to_lookup{{/translate}}
For more details, please refer to Translations
If there are no mapping rules set, DotApparel will populate default values for some key Shopify fields. For more details, please refer to .