如何将 Shopify 购物车添加到 Hugo 电子商务网站

发布于 2025-01-12 01:12:07 字数 324 浏览 3 评论 0原文

我使用 Hugo 创建了一个静态电子商务网站。

Hugo 电子商务网站

想要通过 Shopify 后台添加产品,并将其反映在我的网站。

我对液体模板非常熟悉。请让我知道如何实现这一目标?

到目前为止,

  1. 我已经创建了一个 Shopify 商店,添加了一个主题并添加了一种产品。
  2. 我不想自定义现有主题,而是完全删除该主题并在其中添加我的网站主题。

I have created a Static e-commerce site using Hugo.

Hugo ecommerce site

want to add products thro' Shopify admin, and get it reflected on my site.

I'm quite familiar with liquid templating. Kindly let me know how to achieve this?

So far,

  1. I have created a Shopify store, added a theme and added one product.
  2. I'm not looking to customize an existing theme, but completely remove that theme add my website theme in it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

身边 2025-01-19 01:12:07

您应该能够使用 Shopify API 获取您的产品。 此端点可能适合您。然后,您可以从 Hugo 中通过 getJson 函数检索产品告诉它 Shopify 授权标头 X-Shopify-Access-Token。像这样:

{{ $data := getJSON "https://your-store.myshopify.com/admin/api/2022-01/products.json" (dict "X-Shopify-Access-Token" "your-token") }}
{{ range $data }}
    {{ . }}
{{ end }}

只需确保您已替换 your-storeyour-token 字符串即可。

You should be able to get your products using the Shopify API. This endpoint could be the one for you. From Hugo, you can then retrieve the products by getJson function with telling it the Shopify authorization header X-Shopify-Access-Token. Like this:

{{ $data := getJSON "https://your-store.myshopify.com/admin/api/2022-01/products.json" (dict "X-Shopify-Access-Token" "your-token") }}
{{ range $data }}
    {{ . }}
{{ end }}

Just make sure that you've replaced both the your-store and your-token strings.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文