Cannot get all the meta fields for Product resource. Tried below api's but none of them gives all the metafields
1)api/2022-01/products/6781390094435/metafields.json? - This returns only metafields that has value
2)api/2022-01/metafields.json?metafield[owner_resource]=product&metafield[owner_id]=6781390094435 -This also returns metafields which has value
Need to get metafields for product even if it does not have value (if possible not for particular product)in order to identity the type of control.
Solved! Go to the solution
Hi @amruta ,
Sadly, it's not possible to retrieve metafields that don't have value. A metafield is not a standard product field; it is a child resource added to a product object. Metafields simply don't exist until you create them (either manually or via the API), and a value must be added for a metafield to exist.
The problem here is that we need to know the type of the metafield before we send the value, but if we can't select it, we can't get the type.
Is there a way to determine the type of the metafield before we create a product with the field?