我正在尝试使用此代码从我的 Shopify 商店检索产品,这是 the examples page 的近乎复制/粘贴。对于 Javascript Buy SDK:
$(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));
});
});
buildClient
命令似乎成功完成,但是我在接下来的两个命令中收到控制台错误:Error: Not Found
。我假设这是指无法找到的产品,但我确信产品和集合 ID 都是正确的。而且我还确定我为我的私有(private)应用程序启用了“产品、变体和集合”的读取权限
。 是否有任何其他原因导致我收到此错误?如果是,有什么解决方案?
最佳答案
明白了。 App ID 不正确。我需要转到 /admin/settings/storefront_access_tokens
并为我的销售 channel 获取正确的 ID。我很失望,因为它很难找到 - 关于这个的文档似乎很复杂。
关于Javascript 购买 SDK - 错误 : Not Found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46009192/