MONEI / Shopify-api-node

Node Shopify connector sponsored by MONEI
https://monei.com/shopify-payment-gateway/
MIT License
940 stars 278 forks source link

Cannot get products metafields #606

Closed aurelien-robineau closed 1 year ago

aurelien-robineau commented 1 year ago

Hi! I need to retrieve metafields for a product, but it returns the shop metafields. My code:

const productMetafields = await shopify.metafield.list({
    owner_resource: 'product',
    owner_id: lineItem.product_id,
    namespace: 'global',
    limit: 250
});

All the returned metafields have the owner_resource set to shop and are indeed shop metafields.

Package version: 3.12.5.

Any clue on why this is happening ?

Thank you!

aurelien-robineau commented 1 year ago

I just made a pull request for that issue.

lpinca commented 1 year ago

See https://github.com/MONEI/Shopify-api-node#metafields. You are missing the metafield key in your options object.

lpinca commented 1 year ago

I'm closing this as answered.