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 custom fields types available:
1) Plain text - a basic text field with no HTML support. A configurable autocomplete list available.
2) HTML - an advanced text field with full HTML support and visual editor enabled
3) Integer - a number that can be written without a fractional component
4) Float (decimal) - a number whose whole number part and the fractional part is separated by a decimal point (or comma)
5) JSON - a standard text-based format for representing structured data
6) Select - allows merchants choose one option from an options menu
7) Multi-select - allows merchants choose multiple options from an options menu
8) Boolean - a form of data with only two possible values (for instance: "yes/no", "1/0", "true/false" etc.)
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) Label - a short name/alias to be displayed alongside with the value box in the metafields editor.
2) Metafield key - a field to store the metafield key.
3) Metafield namespace - a field to store the metafield namespace.
4) Field type - in our case, it will be a multi-select field
5) Click the configuration button to configure options for this multi-select.
On the next screen you can configure:
1) values delimiter - a sequence of one or more characters for specifying the boundary between the items' values
2) option label - a short name/alias of the option for displaying in the drop-down menu
3) option value
4) options sort order
5) additional notes
6) if the automated sorting won't work for you, you can adjust items manually by dragging the highlighted boxes
Click "Apply" button once you're done. On the next screen, hit "Save" button to save the changes:
Awesome, the first metafield set with a single item 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 warehouses have been selected yet, an empty metafield set item look like this:
You may want to select one or more warehouses and see what changes:
Press "Save" button to save the changes.
Congratulations, the first metafield set item 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":
Great. Now you can move back to the metafield set configuration menu and add the other 3 "shipping" metafields just like you did with warehouse zip metafield. You can add a metafield to a set by clicking the "Add metafield" button:
Next, let's see the complete metafield set:
Now that your metafield set's configuration is done, let's get back to a product metafields editor and see the set in action:
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: