Shopify Storefront GraphQL API 获取可用国家/地区和州/省的列表(不带 REST API)

发布于 2025-01-15 04:59:25 字数 548 浏览 1 评论 0原文

要求:请勿使用 Shopify Admin Rest API

如何使用 Storefront GraphQL API 获取国家/地区及其州/省的列表?

我正在 React 创建一个页面,客户可以在其中编辑他们的地址。对于我的

我尝试了此查询,但看起来无法检索州/省。为什么此处不可用州/省?

https://shopify.dev/api/storefront/2022-01/对象/国家#字段

{
  localization {
    availableCountries {
      name
    }
  }
}

Requirement: Do not use the Shopify Admin Rest API

How do I get a list of the countries and their states/provinces with the Storefront GraphQL API?

I am creating a page in React where a customer can edit their address. For my <Select> fields, for countries and provinces, I want to use the Storefront GraphQL API because that is what all of the other queries in my React site are written with.

I tried this query but it looks like the states/provinces are not available to be retrieved. Why are the states/provinces not available here?

https://shopify.dev/api/storefront/2022-01/objects/Country#fields

{
  localization {
    availableCountries {
      name
    }
  }
}

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文