EZ Inventory: Using Formulas for Mapping Product Variants in Shopify

EZ Inventory has supported using formulas for inventory quantity updates for quite some time now.  This allowed our users to use conditional logic and other data manipulation against their supplier feed's data when updating the quantity in Shopify.

We've just pushed an update to extend this functionality for mapping items from their supplier's feed to product variants in their Shopify store.  This option is now available in the Data Feed settings:

Since most merchants don't have the option to modify or customize their supplier's feed, this option could come in handy in cases where the product/variant IDs from their supplier's feed don't match the ones they use in their Shopify store exactly.

For example, it's possible for a merchant to have two suppliers/vendors carrying the same SKUs or Barcodes.  What the merchant might do in this case is create two separate product variants in Shopify for each SKU and append the vendor's name to them to identify which vendor is stocking which variant.

In this scenario, the merchant can use a conditional logic formula to append additional text to the SKU field from the supplier's feed only for certain SKUs and use the original SKU value for the rest of the items like this:

{{ SKU }} + "-VENDOR1" if {{ SKU }} in ["ABC123", "DEF456"] else {{ SKU }}

This way, the SKU data from the supplier's feed is adjusted on the fly before doing a lookup against the merchant's product variant database in Shopify (this occurs internally in our app, the original feed is not modified at all).

Below are other examples to give you an idea of different scenarios where this could come in handy.

1. Convert the value of the "sku" field in the inventory feed to all uppercase letters.

{{ sku }}.upper()

To convert to all lowercase instead:

{{ sku }}.lower()

2. Convert the value of the "sku" field in the inventory feed to all uppercase and then append the text "-VENDOR1" to it.

{{ sku }}.upper() + "-VENDOR1"

3. Append "-VENDOR1" only to specific SKUs, use the original value for the rest of them.

{{ sku }} + "-VENDOR1" if {{ sku }} in ["DHS1231", "3EA1441", "R2D2113"] else {{ sku }}

4. Remove all spaces from the "item_id" field of the inventory feed.

{{ item_id }}.replace(" ", "")

5. Replace the "-" character from the "item_id" field with the "X" character.

{{ item_id }}.replace("-", "X")

6. Remove all leading and trailing zeros from the value of the "item_id" field.

{{ item_id }}.strip("0")

To remove only the leading zeros:

{{ item_id }}.lstrip("0")

To remove only the trailing zeros:

{{ item.id }}.rstrip("0")

7. Replace the values in the "item_id" field with new values (similar to a lookup table). If there's no match from the key/value lookup, use the original value.

{"DA3821": "NEW-555112", "XHD1381": "NEW-381231", "YWF8124": "NEW-43818"}.get({{ item_id }}, {{ item_id }})

As you can see from these examples, the formulas are quite flexible where you have very simple ones and also very complex ones.  If you have any questions about this feature, don't hesitate to reach out!  


Related Posts:


Tags: new features, ez inventory, inventory management, inventory feeds, shopify inventory updates, stock sync