Javascript Buy SDK - Error: Not Found

Javascript Buy SDK - Error: Not Found

我正在尝试使用此代码从我的 Shopify 商店检索产品,Javascript Buy SDK 的 the examples page 接近 copy/paste:

$(function() {
  var shopClient = ShopifyBuy.buildClient({
    accessToken: '4b4e3d4bba63039f2d51db94c2e79a46',
    domain: 'squatch-air-clutches-test.myshopify.com',
    appId: '6'
  });

  shopClient.fetchQueryProducts({
    collection_id: 1397227547
  }).then(function(products) {
    $('.test').append(JSON.stringify(products));
  });

  shopClient.fetchProduct('46656520219').then(function(product) {
    $('.test').append(JSON.stringify(product));
  });

});

Here's a fiddle.

buildClient 命令似乎成功完成,但是我在接下来的两个命令中收到控制台错误:Error: Not Found。我假设这是指无法找到的产品,但我确信产品和集合 ID 都是正确的。而且我还确定我的私人应用程序已为 "products, variants, and collections" 启用了 read access是否有任何其他原因导致我收到此错误,如果是,有什么解决方案?

知道了。 App ID 不正确。我需要前往 /admin/settings/storefront_access_tokens 并为我的销售渠道获取正确的 ID。我很失望,因为它很难找到 - 关于这个的文档似乎很复杂。