我目前正试图找出一些自定义数据传递给我的每个shopify订单确认。具体来说,我需要传递一个自定义URL,该URL将显示在订单确认电子邮件中。根据shopify文档,我可以从产品中接收财产,然后将其传递给我的确认表。
{% assign property_size = item.properties | size %}
{% if property_size > 0 %}
{% for p in item.properties %}
{% assign first_character_in_key = p.first | truncate: 1, '' %}
{% unless p.last == blank or first_character_in_key == '_' %}
{{ p.first }}:
{% if p.last contains '/uploads/' %}
<a class="lightbox" href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
{% else %}
{{ p.last }}
{% endif %}
<br>
{% endunless %}
{% endfor %}
{% endif %}
使用此功能,我可以通过执行以下操作来传递自定义网址:
mycustomurl.com/linepropertyitem
我的问题是,每个line属性都包含line属性项的标题和输入值。所以我使用这种方法的网址将是
mycustomurl.com/linepropertyitem = linepropertyitemtext
任何想法或指示如何做到这一点?
在网址中不起作用。
答案 0 :(得分:0)
您可以这样做:
{% assign property_size = item.properties | size %}
{% if property_size > 0 %}
{% for p in item.properties %}
{% assign first_character_in_key = p.first | truncate: 1, '' %}
{% unless p.last == blank or first_character_in_key == '_' %}
{% if p.last contains '/uploads/' %}
<a class="lightbox" href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
{% else %}
{{ p.first }}:
{{ p.last }}
{% endif %}
<br>
{% endunless %}
{% endfor %}
{% endif %}
但是最好的办法是分析Shopify的代码并了解发生了什么。这样,您将能够自己做更多的事情。