OverviewPlatformsAPI ReferenceResources
Commerce

Set collection metafields

PUThttps://zernio.com/api/v1/commerce/collections/{collectionId}/metafields

Creates or updates custom fields by namespace and key. Needs collections.metafields: WooCommerce keeps custom fields on products only and answers 400 platform_not_supported.

PlatformsShopify

Authentication

AuthorizationBearer tokenRequired

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

Path parameters

collectionIdstringRequired

Platform-native id.

Body

application/json

What every request needs

accountIdstringRequired
metafieldsarray of CommerceMetafieldRequired
namespacestringRequired
keystringRequired
typestringRequired

Platform value type, e.g. single_line_text_field, number_integer, json.

valuestringRequired

The value serialized as a string, JSON for structured types.

Responses

Success· the request worked

Errors· the request failed

PUT/v1/commerce/collections/{collectionId}/metafields
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.commerce.setCommerceCollectionMetafields({  path: {    collectionId: 'collection_abc123',  },  body: {    accountId: 'account_abc123',    metafields: [      {        namespace: 'string',        key: 'tok_abc123',        type: 'string',        value: 'string',      },    ],  },});console.log(data);
{  "metafields": [    {      "namespace": "string",      "key": "string",      "type": "string",      "value": "string"    }  ]}
OpenAPI specification
Was this page helpful?