如何在 templates/customers/order.liquid 模板上打印信用卡的最后 4 位号码?

问题描述 投票:0回答:2

我希望能够向登录客户显示卡类型和最近 4 张信用卡。但交易对象似乎无法在

/templates/customers/order.liquid
模板内使用。如何使交易对象在
/templates/customers/order.liquid
内可用?

card type: {{ transaction.payment_details.credit_card_company }}
card xxxx: {{ transaction.payment_details.credit_card_number }}
shopify liquid
2个回答
0
投票

交易对象是

order.transactions
数组的一部分。 (因为每个订单可以进行多次交易)

为了输出它们,您需要循环数组。

{% for transaction in order.transactions %}
  card type: {{ transaction.payment_details.credit_card_company }} <br/>
  card xxxx: {{ transaction.payment_details.credit_card_number }} <br/>
{% endfor %}

0
投票

我注册了一个 stackoverflow 帐户来向您表示感谢! =)它有效

© www.soinside.com 2019 - 2024. All rights reserved.