Liquid、JavaScript、主题、销售渠道。
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>