Supply Lens

Product options, order metadata and tags

Lesson 7 of 30 7 min read

Resolve Magento custom options into readable names, pull shipping instructions from custom metadata, and generate tags from order fields.

Personalised products are where Magento orders get tricky. A shopper picks "Rope Colour: Red", but Magento records only an option ID and a value ID, with no names. A warehouse can't pick "option 14, value 52". This lesson shows how to turn those IDs into words, and how to carry other Magento-only details across as tags.

By the end of this lesson you'll be able to decide when to resolve product options, read the tags they produce, and pull shipping instructions out of a custom metadata collection.

Resolving product custom options

resolveProductOptionsDefault false. When on, Supply Lens looks up each ordered product's custom options in Magento during import, so the option and value IDs are resolved to their names and values.

With it on, each option is added to the order line as a line option carrying the resolved name and value and the original Magento IDs. It's also recorded as two tags:

Tag formExample
magento:product_option:<name>:<value>magento:product_option:Rope Colour:Red
magento:product_option_<name>:<value>magento:product_option_Rope Colour:Red

The second form puts the option name into the tag key, so you can match a particular option directly in a tag map. Because tags are colon-separated, any colons in an option name are removed from the key.

With it off, the raw option and value IDs are still recorded on the line options; only the names, values and tags are missing.

It costs API calls

Resolving options needs an extra Magento API call per distinct product on the orders being imported. Results are cached for the run, so a product ordered several times is looked up once. That's why it's off by default. Turn it on when someone downstream needs the option names.

Custom order metadata

Some Magento shops store extra order details in a custom key-value collection. Four settings read it:

keyValueCollectionNameThe name of the custom key-value collection on the Magento order.
keyValueCollectionKeyNameThe field in that collection holding the keys.
keyValueCollectionValueNameThe field in that collection holding the values.
keyValueCollectionKeyShippingInstructionsThe key whose value is the order's shipping instructions. When set, that value becomes the shipping instructions on the Document.

You need all three names before the collection can be read, and the shop's Magento developer is the person who knows them.

Generating tags

documentLevelTagGeneration and documentLevelAdvancedTagGeneration work exactly as described in the patterns module: rules that read a field on the Magento order and write it as a tag. Use them for anything the target needs that has no dedicated setting.

Fern & Finch: personalised rope lights

Fern & Finch sells rope lights with a colour option and a gift message. Their 3PL needs the colour on the pick list, and the gift message on the packing slip.

  1. The implementer turns on resolveProductOptions. Order lines now carry Rope Colour: Red as a line option, plus the tag magento:product_option_Rope Colour:Red.
  2. The gift message lives in a custom collection called order_attributes with fields code and value. She sets the three collection names and sets keyValueCollectionKeyShippingInstructions to gift_message, so it arrives as the shipping instructions.
  3. The shop takes about 300 orders a day across 60 products, so the extra lookups are acceptable; caching means each product is looked up once per run.

Recap

  • Magento records custom options as IDs; resolveProductOptions turns them into names, values and two forms of tag.
  • It's off by default because it needs an extra API call per distinct product per run.
  • The second tag form puts the option name in the key, which is easiest to match in a tag map.
  • A custom key-value collection can supply shipping instructions.
  • Tag generation rules cover anything else.
Complete and continue

Your progress is saved in this browser. Create a free account to keep it everywhere, take quizzes and earn certificates.