繁体   English   中英

使用Admin API的Shopify订单状态

[英]Shopify Order Status using Admin API

我需要使用Shopify API获取订单状态。 我知道有效载荷,并且能够获得订单响应,但想知道如果有人方便的话获取订单状态行的逻辑。

就像我得到履行状态,付款状态,确认状态,处理方法,取消方法一样,因此要使用所有这些属性和其他属性,我要画一条线,以便为最终用户提供完整的状态。

例如,“您的订单已确认并准备好发货,它将在下周到达您。谢谢”

有什么帮助吗?

您共享的示例消息将是若干Shopify API资源合并的结果。 要逐步遍历setp,您将需要使用以下3个API资源。

  1. 订购
  2. 履行
  3. 履行活动

首先从“订单”资源中,查看“ complement_status”字段。 有效值为

  • 已发货:显示已发货的订单。
  • 部分:显示部分发货的订单。
  • 未发货:显示尚未发货的订单

在“实现”资源中,查看statusshipping_status字段。

在FulfillmentEvent资源中,查看Estimated_delivery_atstatus字段。

将这些字段组合在一起,就可以了解是否满足以下任何条件,装运状态和预计交货日期。

您可以查看Shopify电子邮件模板中的代码,这些模板在运输确认等信息上发送。

发货确认电子邮件中的示例代码

{% if fulfillment.item_count == item_count %} 
  {% capture email_title %}Your order is on the way{% endcapture %}
  {% capture email_body %}Your order is on the way. Track your shipment to see the delivery status.{% endcapture %}
{% elsif fulfillment.item_count > 1 %} 
  {% if fulfillment_status == 'fulfilled' %}
    {% capture email_title %}The last items in your order are on the way{% endcapture %}
    {% capture email_body %}The last items in your order are on the way. Track your shipment to see the delivery status.{% endcapture %}
  {% else %}
    {% capture email_title %}Some items in your order are on the way{% endcapture %}
    {% capture email_body %}Some items in your order are on the way. Track your shipment to see the delivery status.{% endcapture %}
  {% endif %}
{% else %} 
  {% if fulfillment_status == 'fulfilled' %}
    {% capture email_title %}The last item in your order is on the way{% endcapture %}
    {% capture email_body %}The last item in your order is on the way. Track your shipment to see the delivery status.{% endcapture %}
  {% else %}
    {% capture email_title %}One item in your order is on the way{% endcapture %}
    {% capture email_body %}One item in your order is on the way. Track your shipment to see the delivery status.{% endcapture %}
  {% endif %}
{% endif %}

{% capture email_emphasis %}Estimated delivery date: <strong>{{fulfillment.estimated_delivery_at | date: "%B %-d, %Y"}}</strong>{% endcapture %}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM