文章分类: Widgets Management
本条还可参阅:

如何在 Shopify 订单确认邮件中显示选定的配送方式和日期?

要在 Shopify 订单确认邮件中显示所选配送方式和日期,请按照以下步骤操作:

步骤 1:点击 Shopify 设置,然后点击通知,再点击客户通知。

设置 -> 通知 -> 客户通知

步骤 2:点击订单确认

步骤 3:点击编辑代码

步骤 4:将以下代码粘贴到您想要显示的位置。请确保将其添加到 <table> 标签内。



<!-- Scrollengine -->
<tr>
<td class="customer-info__item">
<h4>配送偏好</h4>
<p>
{% if attributes["DELIVERY_METHOD"] %}
<div style="display:flex; gap:10px;"> 配送方式:{{ attributes["DELIVERY_METHOD"] }} </div>
{% else %}
<div style="display:flex; gap:10px;"> 配送方式: </div>
{% endif %}
</p>

<p>
{% if attributes["STORE_LOCATION"] %}
<div style="display:flex; gap:10px;"> 门店:{{ attributes["STORE_LOCATION"] }} </div>
{% else %}
<div style="display:flex; gap:10px;"> 门店: </div>
{% endif %}
</p>

<p>
{% if attributes["DATE"] %}
{% assign date_parts = attributes["DATE"] | split: "-" %}
<div style="display:flex; gap:10px;"> 日期:{{ date_parts[2] }}/{{ date_parts[1] }}/{{ date_parts[0] }} </div>
{% else %}
<div style="display:flex; gap:10px;"> 日期: </div>
{% endif %}
</p>

<p>
{% if attributes["SLOT"] %}
{% assign time_parts = attributes["SLOT"] | split: " " %}
{% assign start_time = time_parts[0] %}
{% assign start_period = time_parts[1] %}
{% assign end_time = time_parts[3] %}
{% assign end_period = time_parts[4] %}

{% comment %} 将开始时间转换为24小时制 {% endcomment %}
{% assign start_hour_min = start_time | split: ":" %}
{% assign start_hour = start_hour_min[0] | plus: 0 %}
{% if start_period == "PM" and start_hour != 12 %}
{% assign start_hour = start_hour | plus: 12 %}
{% elsif start_period == "AM" and start_hour == 12 %}
{% assign start_hour = 0 %}
{% endif %}
{% assign start_time_24h = start_hour | append: ":" | append: start_hour_min[1] %}

{% comment %} 将结束时间转换为24小时制 {% endcomment %}
{% assign end_hour_min = end_time | split: ":" %}
{% assign end_hour = end_hour_min[0] | plus: 0 %}
{% if end_period == "PM" and end_hour != 12 %}
{% assign end_hour = end_hour | plus: 12 %}
{% elsif end_period == "AM" and end_hour == 12 %}
{% assign end_hour = 0 %}
{% endif %}
{% assign end_time_24h = end_hour | append: ":" | append: end_hour_min[1] %}

<div style="display:flex; gap:10px;"> 时间段:{{ start_time_24h }} - {{ end_time_24h }} </div>
{% else %}
<div style="display:flex; gap:10px;"> 时间段:</div>
{% endif %}
</p>
</td>
</tr>
<!-- Scrollengine -->
```

然后预览并保存即可。

**如果您仍然遇到任何问题,请联系客服。**

更新于: 05/01/2026

这篇文章有帮助吗?

分享您的反馈意见

取消

谢谢!