Available for our advanced plans, metafield set is a feature that allows you create lists/groups of metafields to be applied to all the entities of a specific resource type (for instance, to all products) or a filtered selection: to products of a specific vendor, to products of a certain product type or to products with a specific tag.
Instead of creating numerous metafields for each product one-by-one, you can now configure a metafield set once and add values for products as needed. Not only it saves time, but also eliminates the need to hassle with the technical details like metafields namespaces, keys, value types - populate the value, save changes and you're ready to go!
To make metafield sets even more flexible and powerful, there is a bunch of different fields types available:
1) Single line text (autocomplete available)
2) Multi-line text (WYSIWYG editor included)
3) Page reference
4) Product reference
5) Variant reference
6) File reference
10) Date and time
12) JSON string
14) Color (with color picker and swatches)
In addition to this, deprecated metafield types are available too:
1) string (autocomplete available)
3) json_string (advanced editor )
Now, let's consider a real-life example of metafield set usage.
Let's say, you're using metafields to store products shipping details for the custom inventory management system: warehouse location ZIP, delivery notes, estimated delivery time and pick-up availability.
Here are the technical details of these metafields:
1) namespace: shipping_info , key: wh_zip, value_type: string, value: ZIP of a warehouse where the product is in stock (imagine you have 4 warehouses in different states: Oregon - 97006 , Florida - 32003, New York - 10001, Alaska - 99503)
2) namespace: shipping_info , key: delivery_instructions, value_type: string, value: a short massage for the warehouse team
3) namespace: shipping_info , key: delivery_time, value_type: string, value: estimated delivery time in business days
4) namespace: shipping_info , key: pickup_available, value_type: integer, value: "1" if pick-up is available, otherwise - leave it empty
In case with the "default" Shopify metafields, you'll have to create these 4 metafields for each of your products, repeatedly typing in the namespace, key and value type. But with metafield sets it's much easier as all you need to do is to configure a metafield set for these shipping details once and then you'll be able to simply populate the values.
To start with, you may want to navigate to the "Sets" section of our app's menu, select the desired resource type and hit the "Create set" button.
Next, the main settings window will appear:
On this page, you can configure some basic data for the metafield set:
1) Title - a short name/alias to describe a metafield set. It will be displayed in the "quick-access" mode of the app.
2) Status - a set can be either active or disabled. Disabled metafield sets won't be accessible from metafields management page.
3) Filters - by default, a metafield set is available for all resources, but you can make it available for a filtered selection only by applying additional filters based on product type, vendor or tags.
4) Description - a text field where you can leave notes for your team or instructions for a client if you're a developer.
Hit the "Create" button when you're done with the basic settings:
Now that we have your first metafield set created, let's configure its items.
Keeping in mind the 4 "shipping" metafields we introduced earlier, let's start with the warehouse zip.
Technically, it's just a text field, so you can go with a plain text field type for this one. However, since we have 4 static values to choose from, a select field type seems to fit our needs even better. Why would someone want to type the same value over and over if they can simply choose one from a drop-down list, right? But wait a minute... what if a product is available from multiple warehouses? In this case, we might use a multi-select type for this metafield. It's pretty much the same as select field, yet allows to choose multiple warehouses at once.
Let's create your first metafield set item by filling in the following attributes:
1) Field type - in our case, it will be a multi-select field.
2) Label - a short name/alias to be displayed alongside with the value box in the metafields editor.
3) Metafield namespace - a field to store the metafield namespace.
4) Metafield key - a field to store the metafield key.
5) Click the configuration button to configure options for this multi-select.
On the next screen you can configure:
1) Metafield value type - you can select either single line text or string (deprecated).
2) Values delimiter - a sequence of one or more characters for specifying the boundary between the items' values.
3) Option label - a short name/alias of the option for displaying in the drop-down menu.
4) Option value
5) Options sort order (optional)
6) if the automated sorting won't work for you, you can adjust items manually by dragging the highlighted boxes
7) Additional notes (optional)
Click "Apply" button once you're done. On the next screen, hit "Save" button to save the changes:
Awesome, our first metafield set is created. Well done!
Let's navigate to products, pick one (matching filter conditions if any filters applied) and see the metafield set in action.
Metafield sets can be found on the same page you usually visit to manage metafields. Each metafield set has its own tab with a respective label and a star icon:
Since no metafield set items were populated yet, an empty metafield set looks like this:
Now you can fill in metafield set items and press Save button::
It's not necessary to fill in all the fields at one. You can leave some of them empty, if you don't need them yet.
Congratulations, the first metafield set is successfully updated:
If you're curious to see whether the data is added to a product correctly, you can switch to a metafields editor tab and see the metafield set items "under the hood":
Yet another cool thing about metafield sets is that you can manage them in the browser extension as well!
Now you can populate metafield values directly from Shopify admin panel with ease: