Type can't be blank for metafieldsSet mutation?

Type can't be blank for metafieldsSet mutation?

ymq
Shopify Partner
28 0 18

As of 2023-01, `metafieldsSet` no longer requires `type` when a corresponding metafield definition exists.

 

ymq_0-1693534043534.png

 

 

 

When we tried to do this, we got the error "Type can't be blank".

 

When we define type, it can be created correctly.

ymq_1-1693534169504.png

 

When we delete the type, an error occurs when creating.

ymq_2-1693534197364.png

 

Replies 8 (8)

ShopifyDevSup
Shopify Staff
1453 238 498

Hey @ymq , great question! 

The `type` field only becomes optional when there's an existing metafield definition that matches the given namespace, key, and owner resource type (derived from ownerId).

What you'll need to do is verify that all the conditions are met for when `type` is not necessary. If these conditions are not met, the `type` field is still mandatory.
 

I hope this clears up any confusion!

- Kyle G. 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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

ymq
Shopify Partner
28 0 18

Thank you very much for your reply!

 

We use the same namespace, key, ownerId.

 

When we first try to create it is perfectly fine.

 

When we try to remove the type a second time (since this was already defined during our first creation). However, when we remove the type, it prompts "Type can't be blank".

 

You can check the two images below, this is our code for the first and second time.

ymq_0-1693610078779.png

ymq_1-1693610087804.png

 

 

By the way, how can I verify whether this metafiled has been defined through namespace, key, ownerId.

 

Thanks again for your help!

niki151
Shopify Partner
4 0 0

Unfortunately, we still have the same issue as Ymq.
We are also using the same namespace, key, and ownerId, but the issue still exists.

 

The time is ticking and the deadline is coming. How to resolve this issue?
A lot of apps will be delisted if everybody from the API team ignores this.

 

ymq
Shopify Partner
28 0 18

Hi,

 

We have fixed this issue.

 

You can refer to the links below to resolve this issue:
https://community.shopify.com/c/shopify-apps/shopify-app-grapql-metafieldsset-update-notice-for-app-...

 

Here are our steps:

 

1. According to the prompt, we changed our "query".

 

2. Switch the api version to "2023-01"

 

best wishes!

 

Ymq app

niki151
Shopify Partner
4 0 0

Hi,

 

thanks for your answer.
We are still using the same method.

According to your steps:
1. Our "query" is using the "type" on creating and updating
2. We are already using "2023-01"

It is working with this method, but the notice came up a few days ago...


According to the changes, we must "remove" the "type" when we are updating.

(I do not know why this is required at all. It is said that this is simplifying, but it is not at all. We need to check if it exists before we decide to add or remove the "type" from the "query". That is a little bit complicated, instead of simplifying..)

ymq
Shopify Partner
28 0 18

Hi,

 

We follow this step.

 

The type is not deleted.

 

Our api “Last detected” has stopped at "Sep 3, 2023". So we think we have solved this problem, but we will continue to observe the prompts of the api.

 

best wishes!

 

Ymq app

elnormarc
Shopify Partner
6 0 4

This doesn't solve anything, Simply switching api version to 2023-01  won't work. I have updated my api version to 2023-01 since last week. But shopify is still reporting it.

elnormarc
Shopify Partner
6 0 4

how do i delete reply, apparently you can't delete reply here, sorry guys?