MONEI / Shopify-api-node

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

Metafields.update() not updating #594

Closed ikudosi closed 1 year ago

ikudosi commented 1 year ago

API version: 2023-01

I'm trying to do a PUT /admin/api/2023-01/variants/49148385/metafields/323119633.json (taken from API docs), is this currently supported in this package?

I see a metafields.update() , though the first argument is id and don't know how it knows whether it's variants or blog?

ikudosi commented 1 year ago

Just to update:

I tried the metafield.update and request went through but did not do any update:

image

Doing it manually with Postman with same payload:

image

utkarsh-24 commented 1 year ago

Hey, I have updated this code please visit this https://github.com/utkarsh-24/Shopify-api-node/tree/update/metafield I have also created the pull request and waiting for it to get merged https://github.com/MONEI/Shopify-api-node/pull/599 Let me know if there is any issues. Thanks.

lpinca commented 1 year ago

@ikudosi the params object should be

{ id: 1899923639543, value: 'false', type: 'string' }
await service.metafield.update(1899923639543, { id: 1899923639543, value: 'false', type: 'string' });
ikudosi commented 1 year ago

@lpinca Oy. Yea that did it. Didn't realize it was doing some other transformation as the root key for the params is metafield. Also surprised no error was thrown or something xD. Ty ty!