Solved

Trouble Linking Metafields To Product Options In Shopify API Version 2024-04

Nexzer
Shopify Partner
7 0 2

I'm attempting to use the productOptionUpdate mutation but when I try to set linkedMetafield and linkedMetafieldValue, I am getting the error "option, linkedMetafield: Linked options are not supported for this shop."

I am using the Development store for the extended variants. Is there a way to get permission to use these metafields?

GraphQL Mutation:

Here's the mutation I'm attempting to use:

mutation productOptionUpdate(
  $productId: ID!,
  $option: OptionUpdateInput!,
  $optionValuesToUpdate: [OptionValueUpdateInput!],
  $variantStrategy: ProductOptionUpdateVariantStrategy
) {
  productOptionUpdate(
    productId: $productId,
    option: $option,
    optionValuesToUpdate: $optionValuesToUpdate,
    variantStrategy: $variantStrategy
  ) {
    product {
      id
      options {
        id
        name
        values
        position
        optionValues {
          id
          name
          hasVariants
        }
      }
    }
    userErrors {
      field
      message
    }
  }
}

JavaScript Variables:

And here are the variables I'm passing:

 

const variables = {
  productId: "gid://shopify/Product/9874",
  option: {
    id: "gid://shopify/ProductOption/4321",
    linkedMetafield: {
      namespace: "test1",
      key: "key1",
    },
  },
  optionValuesToUpdate: [
    {
      id: "gid://shopify/ProductOptionValue/1234",
      linkedMetafieldValue: "example",
    }
  ],
};

 

Development Store:

And here is the development store I am using:

Nexzer_0-1712484254894.png

 

Accepted Solution (1)

Ashish_Shah
Shopify Staff
20 7 26

This is an accepted solution.

Hello @Nexzer 

You are right. The linkedMetafield is only available to shops in beta and will soon be available to all shops..  Please watch out on the change log for updates.

 

Thanks

 

ALIAS | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 2 (2)

Ashish_Shah
Shopify Staff
20 7 26

This is an accepted solution.

Hello @Nexzer 

You are right. The linkedMetafield is only available to shops in beta and will soon be available to all shops..  Please watch out on the change log for updates.

 

Thanks

 

ALIAS | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Nexzer
Shopify Partner
7 0 2

I am using a beta store. Developer preview "extended variants" and its still not letting me use the meta fields.

My question of this post is what type of beta store do I need to use to test these metafields?