App reviews, troubleshooting, and recommendations
I have encountered a problem while trying to add a pre-set metafield to a product via API in my store.
Below are the details of the issue:
Metafield Creation:
API Request:
Error Response:
Here's my request:
url -X POST "<store>/admin/api/2023-10/products/<id>/metafields.json" -H "X-Shopify-Access-Token: <token>" -H "Content-Type: application/json" -d '{"metafield": {"namespace": "custom","key": "Era","type": "list.single_line_text_field","value":["40s"]}}'
I tried posting different type:
{
"errors": {
"type": ["'single_line_text_field' must be consistent with the definition's type: 'list.single_line_text_field'."],
"value": [" does not exist in provided choices: [\"40s\", \"50s\", \"60s\", \"70s\", \"80s\", \"90s\", \"2000s\"]."]
}
}
Hi,
https://shopify.dev/docs/api/admin-graphql/2023-10/objects/Metafield
The data stored in the metafield. Always stored as a string, regardless of the metafield's type.
I think your value is an array, so you need to remove the [ ] in your value ?
Thank you for reply.
I tried this before and it does not work. Response:
{
"errors": {
"value": ["must be an array."]
}
}
Also: see Shopify instructions for lists.
list.single_line_text_field | A list of single-line text fields. | [] | yes | no |
Hi @threestarjaacie,
If you're looking to implement custom fields in your Shopify store without the need for coding, I'd recommend exploring the Easify Product Options app. It offers a Free plan and makes setting up custom options a breeze, far more efficient than working with Shopify metafields 😊.
Can I also post these fields via API?
In general it does not solve/answer my question. Still hoping on some answer.
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024