FROM CACHE - zh-cn_header
此社区已转向点对点支持。Shopify 支持团队将不再为此社区提供服务。我们建议您与其他商家和合作伙伴建立联系以获取帮助,并分享您的经验! 如发现有任何违反我们行为准则的行为或您希望删除的内容,欢迎继续举报。

社区即将迁移!从 7月7日 开始,当前社区将进入只读状态,持续约两周。期间您仍可浏览内容,但暂时无法使用发布功能。详细了解

ShopifyStorefrontAPIClient Cannot read properties of undefined (reading 'get')

ShopifyStorefrontAPIClient Cannot read properties of undefined (reading 'get')

furyfrog
Shopify Partner
1 0 0

when I create a html to get shopify,I get an error :Cannot read properties of undefined (reading 'get'). What should I do? 

Here is code:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script src="https://unpkg.com/@shopify/storefront-api-client@0.2.3/dist/umd/storefront-api-client.min.js"></script>

    <script>
      async function test() {
        const client = ShopifyStorefrontAPIClient.createStorefrontApiClient({
          storeDomain: "https://mystore.myshopify.com",
          apiVersion: "2024-07",
          publicAccessToken: "my token",
        });
        console.log(client)
        const productQuery = `
       {
      	shop {
      		name
      	}
      }
      `;

        const { data, errors, extensions } = await client.request(productQuery);
        console.log(data, errors, extensions);
      }
      window.onload = function () {
        test();
      };
    </script>
  </body>
</html>
0 条回复0