Using metafields on labels
Add Shopify product and variant metafields to BarcodeMan labels, including custom text, images, namespaces, and keys.
On this page
Metafields store extra product information, such as material or care instructions. To print that information, create a field in Shopify, give it a value on a product, then link a BarcodeMan element to it.
A product metafield has one value shared by that product’s variants. Use a variant metafield when each variant needs its own value. Each field has a namespace and key, such as custom.material, which BarcodeMan uses to identify it.
Create a text field in Shopify
If the field already exists, skip to filling in its value.
- In Shopify admin, open Settings → Metafields and metaobjects and choose Products. Choose Variants for a field that belongs to individual variants.
- Click Add definition and name it
Label material. - Check Namespace and key. For this example, use
custom.label_materialif that key is available, or keep the generated key and use it throughout the steps below. - Click Select type, choose Single line text, and keep One value.
- Click Save.
Older Shopify screens may call this settings section Custom data. Shopify also provides an Add definition action in a product’s Metafields section. See Shopify’s definition setup instructions.
Fill in the product’s value
- Open Products in Shopify admin and select a product. For a variant metafield, open the specific variant.
- Find Metafields and open
Label material. If it is not displayed, click View all. - Enter
Cottonand click Save.
Repeat for other products or variants that need this field. Creating the definition does not fill in their values. See Shopify’s instructions for adding values.
How to add a metafield to your label
Displaying images from metafields
For an image URL, such as the address of a certification logo, create a separate field:
- Return to the product or variant metafield definitions in Shopify and click Add definition.
- Name it
Label imageand note its Namespace and key, for examplecustom.label_image. - Under Select type, choose URL, keep One value, and click Save.
- Open the product or variant. In Metafields, fill
Label imagewith a direct image URL and save. Use View all if the field is hidden.
The URL must open the image itself and be accessible without signing in. A product page URL will not work. Shopify’s File type stores a file reference, which is different from the URL field used in this example. See Shopify’s metafield types.
In BarcodeMan:
- Add an Image element to your template.
- Set Link To to METAFIELD_PRODUCT or METAFIELD_VARIANT, matching where you saved the URL.
- Select the definition in the new editor, or enter its
namespace.keyin the legacy editor. - Save the template and generate a label for that product or variant.
If the image fails to load, follow Image does not show on label. A publicly accessible image can still have browser access restrictions.
Troubleshooting
Metafield shows blank on the label
Check the value on the exact product or variant you are printing. Then check that the element uses the matching product or variant source and the correct namespace.key. A field that exists but has no value will not supply text for the label.
Metafield list won’t load (new editor)
Use Try again if a loading error appears. If loading succeeds but the list is empty, confirm that the definition belongs to the selected product or variant type. Reopen the editor after creating a new definition if it has not appeared yet.
In the legacy editor, enter namespace.key manually; there is no definition list.
Wrong metafield value showing
Make sure you selected the correct metafield (check the namespace and key). Choose the matching product or variant source before selecting or entering the key.
Questions about this article? Email our team.
Send feedback