Error when trying to use metafields in productSet

I’m trying to create a product using the productSet API operation, I provide this metafield:

[{ namespace: “custom”, key: “material”, value: “["TestMaterial"]”, type: “single_line_text_field” }]

on the ProductSetInput.metafields. I have also tried using “list.single_line_text_field”.

I get this error that I can’t find anything about: “Owner subtype does not match the metafield definition’s constraints.”.

On the “Product metafield definitons” page, this metafield is under “Assigned to categories”.

How can I solve this?

The reason was that I needed to assign a category first. Not a good error message at all.

1 Like

Hi Team,

I am also facing a similar issue where the metafield type is a Metaobject (List). How to fix this?

FYI for others who run into this error, you can also get it if the metafield is a category metafield and the product has a category that doesn’t have that metafield available.

For example, this error can appear in Shopify Flow automations when the automation is trying to assign a value to a category metafield. Let’s say that you have a metafield “wheel size” that is available only on vehicles, and you’re trying to add a value for “wheel size” to a bike trailer. You will need to edit the metafield to make it available on the bike trailer category, otherwise the workflow will return that error.

1 Like

thanks - saved me some time today this comment
tried including uncategorised on the metafield category assignments - but that didn’t seem to work
but changing metafield to apply to all products worked for me