We are having issues using the metafields on a product on the /admin/api/2020-07/products.json rest api endpoint.
If “metafields” is either not included, or is set to an empty array, the product is creating without issue.
However when trying to create a product with metafields we are receiving the following error :
{"errors":{"metafields":"expected Hash to be a Array"}}
This is happening on both creates and updates.
Sample request payload :
{
"product": {
"product_type": "Physical Product",
"title": "Metafield Example Product",
"body_html": "",
"variants": [],
"images": [],
"tags": "",
"metafields": [
{
"key": "option_one",
"field": "metaOptionOne",
"value": "Wishlist potential: High",
"namespace": "custom_fields",
"value_type": "string"
},
],
"published": true,
},
}