Metafield List API reference
The Metafields List API retrieves custom metafields associated with products.
GET /api/front/metafields/product/list
The following example requests metafields for a specific product
GET /api/front/metafields/product/list?owner_ids={owner_id}&namespace={namespace}&key={key}&page={page}&limit={limit}
Query parameters
Parameter | Required | Type | Description | Example Value |
---|---|---|---|---|
owner_ids | No | string[] | List of owner IDs associated with products. | 3320697d-4d2d-4bc0-b5f5-d82da4e6bc87 |
namespace | No | string | The namespace of the metafields. | custom |
key | No | string | The key of the metafield. | color |
definition_id | No | string | ID of the metafield definition. | 98765 |
limit | No | int | Number of records to return per page. | 10 |
page | No | int | Page number. | 0 c |
Example Requests using Fetch
fetch(window.SHOPLAZZA.routes.root + '/api/front/metafields/product/list?page=0&limit=8')
.then((response) => response.json())
.then((data) => {
// do something...
});
fetch(window.SHOPLAZZA.routes.root + '/api/front/metafields/product/list?owner_ids=product_id1&owner_ids=product_id2')
.then(response => response.json())
.then(data => {
console.log(data);
});
Successful response
{
"data": {
"metafields": [
{
"id": "id",
"store_id": store_id,
"owner_id": "owner_id",
"owner_resource": "product",
"namespace": "custom",
"key": "color",
"value": "value",
"type": "string",
"description": "",
"created_at": "2025-03-14T05:53:31Z",
"updated_at": "2025-03-17T05:03:35Z"
}
],
"total": 1,
"remain": 0,
"page": 0,
"total_page": 1,
"have_next": false
},
"msg": "请求成功",
"state": 0
}
Updated 3 days ago