skip to Main Content

I’m using the Shopify SDK ‘Shopiy-API-Node‘ and wonder how to get metafields of a smart collections ?

The Shopify api says:

GET /admin/collections/#{id}/metafields.json

Also, from NodeJS I use :

shopify.metafield.list(
    { 
        metafield: { 
            owner_resource: 'COLLECTION', 
            owner_id: '4576719568993' 
        }
    }
);

But it returns a 404, while I’m sure there are Metafields datas, as the Shopify Api returns the Metafields if queried without the SDK.

Cheers
Alan

2

Answers


  1. Chosen as BEST ANSWER

    I managed to make it work this way :

    shopify.metafield.list(
        { 
            metafield: { 
                owner_resource: 'collections', 
                owner_id: '4576719568993' 
            }
        }
    );
    

    You have to use "collectionS".


  2. You might be getting an empty response because you are only entitled to get metafields your API key created. If you have not used your API key to attach a metafield to a collection, then [] is correct.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search