使用 CarrierService 时无法获取 min_delivery_date 和 max_delivery_date

Can't get min_delivery_date and max_delivery_date when using CarrierService

Shopify

黎明主题,

我想在页面 checkout.liquid 上显示最小和最大交货日期,使用 CarrierService (Shopify API)。

我需要得到 min_delivery_datemax_delivery_date。问题是我请求 - /admin/api/2022-01/carrier_services.json,但得到的响应没有 min_delivery_datemax_delivery_date.

我收到这样的回复:

{
   "carrier_services":[
      {
         "id":57492111453,
         "name":"dhl_express",
         "active":true,
         "service_discovery":true,
         "carrier_service_type":"legacy"
      },
      {
         "id":57492144221,
         "name":"ups_shipping",
         "active":true,
         "service_discovery":true,
         "carrier_service_type":"legacy"
      },
      {
         "id":57492078685,
         "name":"usps",
         "active":true,
         "service_discovery":true,
         "carrier_service_type":"legacy"
      }
   ]
}

问题:为什么 min_delivery_datemax_delivery_date 没有显示?

我不明白为什么会这样。

请帮忙。

您要求 Shopify 为您提供承运人服务列表,它的响应是正确的。您看到的是三种,DHL、UPS 和 USPS。向 Shopify 询问承运人服务列表与结账无关,并且是向承运人服务提出的请求。

如果您想知道运费响应的交货日期,您必须检查承运人服务的响应!这不是你要做的事情。相反,当您在自己的应用程序中部署运营商服务时,您可以自己形成响应。

很明显,如果您对 min/max 交货日期感兴趣,请打开您安装的应用程序中的代码,并找出为什么没有提供日期。另外,请注意,使用 min/max 交货日期作为响应是很棘手的事情!它需要对工作日、周末和您响应的结果有深入的了解才能正确处理。