Skip to content

I'm unable to update a metafield of type file list #316

@mihaiav

Description

@mihaiav

I have a product with a custom metafield of type list of files .
I've tried the following to pass information (some images):

        shop.Metafield{
			Key:       key,
			Namespace: ns,
			Value:    `["gid://shopify/ProductImage/66131787907409"]`,
			Type: shop.MetafieldType("list.file_reference"),
		}

I get the error
metafields.value: must be a file reference string.

For debugging purposes I also tried only one value/string

           shop.Metafield{
			Key:       key,
			Namespace: ns,
			Value:    `"gid://shopify/ProductImage/66131787907409"`,
			Type: shop.MetafieldType("list.file_reference"),
		}

I get the error: metafields.value: must be an array.

Also tried:

              shop.Metafield{
			Key:       key,
			Namespace: ns,
			Value:    []string{"gid://shopify/ProductImage/66131787907409"},
			Type: shop.MetafieldType("list.file_reference"),
		}

I get error value: expected Array to be a String

Any idea how am I supposed to pass a list of files (images) ? This drives me absolutely crazy! I've spent 4 hours trying to fix this...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions