Issue: A user attempted to add a product metafield (custom key–value data) via the Shopify Admin REST API and expected it to appear in the bulk editor, but received 200 responses with no metafield created.
Attempts and symptoms:
POST via Postman to /admin/api/2021-04/products/{id}/metafields.json with integer value; 200 response, no change.
Browser-based fetch requests returned 200, later 301 (redirect) with cf-request-id; GET on product showed empty metafields array.
Key guidance provided:
Clear cookies in Postman; POST requests with cookies are blocked for security.
Do not use the browser console for Admin API calls, as cookies are always sent, causing blocks/redirects.
Capture and share the response request ID for debugging if issues persist; likely authentication-related.
Example payload with namespace/key/value (string) succeeded; verify by sending a GET to the same endpoint to see the new metafield.
Status: Resolved with proper Basic Auth and cookie clearing. Browser-originated Admin API requests remain unsuitable due to authentication/cookie constraints. Code snippets are central to the solution.
Summarized with AI on February 28.
AI used: gpt-5.
Hi there. I am trying to add a metafield to a product. I am expecting that the new metafield to be available in the selection table below.
When I submit the request I get status 200 and the the following response body:
When I check the product bulk editor there are no new metafields.
**Steps taken:**
I am using postman to make the post request with the following URL:
*https://{MY STORE}/admin/api/2021-04/products/{PRODUCT ID}/metafields.json*
The request body is:
```javascript
{
"metafield": {
"namespace": “test”,
"key": “test_metafield”,
"value": 50,
"value_type": "integer"
}
}
Authorisation is set to “basic auth” and I have used my username and password for the private app.
I think I missing something fundamental here. Am I using the API incorrectly or am I more generally thinking about the metafields feature incorrectly?
I would like to understand how manipulating metafields works without using an app.
So you’re trying to make a metafield in Postman and you’re getting that response back? In the desktop version of postman look to the top right hand side for the “cookies” option. Click on that and remove all the cookies.
Change requests (like POST) made with cookies attached are blocked for for good security reasons.
Thanks Jason. No luck unfortunately. I had deleted cookies previously after seeing one of your responses to an earlier post - but I double checked just in case.
I’ve since tried sending a fetch request from the store console as follows:
I still get a successful 200 response but no change in the metafields. I ran a get request on the products as well to check which returns an empty metafields array.
Any thoughts? Any other info I could provide which might help diagnose the problem?
It won’t work from the browser console given cookies are always sent in those. If you’re still having issues then capture the request id that’s in the header response and post that here. It still feels like authentication issues to me on first glance but let’s see.
I tried running the same request through application.js (and separately within a script tag) with the same result (not sure if that would make a difference anyway given the request will still originate in the browser). As a guess I tried embedding the script and request within liquid and had the same result again.
In all attempts the request is returning a status code of 301 and, for a request from application.js, the response header returns cf-request-id: 09f063162c0000e9b7502fa000000001.
Let me know if I can provide further information or run a different test to help diagnose the problem.
{
"metafield": {
"namespace": "SEO",
"key": "google_product_category",
"value": "All Flowers > Sorbet Rose",
"value_type": "string",
"description": "a meta field for product feed"
}
}
Worked just fine, to test it’s success, use the above URL as a [GET] and you should see your newly added metafield