MONEI / Shopify-api-node

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

inventoryLevel is undefined and unavailable #225

Closed chaddjohnson closed 6 years ago

chaddjohnson commented 6 years ago

I just tried using the InventoryLevel API via the following:

'use strict';

const Shopify = require('shopify-api-node');
const client = new Shopify({
    shopName: 'test-shop',
    accessToken: 'access-token'
});

client.inventoryLevel.list({inventory_item_ids: '123456789012345'})
    .then(data => console.log(JSON.stringify(data, null, 2)))
    .catch(error => console.error(error));

and I get the following:

/Users/chad/development/sandbox/shopify/getInventoryLevel.js:9
client.inventoryLevel.list({inventory_item_ids: '123456789012345'})
                     ^

TypeError: Cannot read property 'list' of undefined
    at Object.<anonymous> (/Users/chad/development/sandbox/shopify/getInventoryLevel.js:9:22)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:607:3

I understand that with Shopify's InventoryLevel API it should be possible to query /admin/inventory_levels.json directly, but this is not possible using MONEI even though the README appears to indicate that this is possible.

Are there plans to make this possible using MONEI?

chaddjohnson commented 6 years ago

Ah! Nevermind. Apologies. I unknowingly had a node_modules directory in the same directory as my script, and this directory had an old version of the library installed.