FROM CACHE - jp_header
解決済

Order Printer で決済方法を日本語表示したい

yuuka_saito
Shopify Partner
6 1 1

Shopifyアプリ「Order Printer」のテンプレート編集をしています。

 

{{gateway}}  で決済方法は表示できましたが、

“shopify_payments”を“クレジット決済”のように日本語表記したいのです。

 

Liquidの書き方を教えていただけませんでしょうか。

よろしくお願いいたします。

 

( {{ transaction.gateway | payment_method }} はなぜか反映されませんでした。

 こちらもなぜ反映されないのか分かる方がいたら教えていただきたいです。)

 

現在編集しているテンプレートです。

 

<h2 style="text-align: center; margin: 0;">
    注文番号 {{ order_name }}
</h2>
<p>{{ "now" | date: "20%y年%m月%d日" }}</p>
   
  {% if shipping_address %}
    <h3 style="margin:1em 0 0 0;">送付先住所</h3>
    <div style="margin:0; padding: 1em; border: 1px solid black;">
      <strong>{{ shipping_address.name }}</strong><br/>
   
      {% if shipping_address.company %}
        {{ shipping_address.company }}<br/>
  
      {% endif %}
      {{ shipping_address.zip | upcase }}
      {{ shipping_address.city }}
      {{ shipping_address.street }}<br/>

<br/>
</div>

<br>

  <h3 style="margin:0;">送り元</h3>
<div style="margin:0 0 1em 0; padding: 1em; border: 1px solid black;">
  <strong>{{ shop.name }}</strong><br/>
  {{ shop.owner }}<br/>
 {{ shop.zip | upcase }}  {{ shop.city }}{{ shop.address }}<br/>
<br/>
</div>

<h3>
{% endif %} 
日付指定:{{ attributes.haisoyamatoshippingdate }}<br>
時間指定:
{% if attributes.haisoyamatoshippingtime == "0812" %}
午前中
{% elsif attributes.haisoyamatoshippingtime == "1214" %}
12:00~14:00
{% elsif attributes.haisoyamatoshippingtime == "1416" %}
14:00~16:00
{% elsif attributes.haisoyamatoshippingtime == "1618" %}
16:00~18:00
{% elsif attributes.haisoyamatoshippingtime == "1820" %}
18:00~20:00
{% elsif attributes.haisoyamatoshippingtime == "2021" %}
20:00~21:00
{% elsif attributes.haisoyamatoshippingtime == "1921" %}
19:00~21:00
{% else %}
{% endif %}
</h3>
<h3>決済方法:{{ gateway }}</h3>
   
  <hr />
   
  <h3 style="margin: 0 0 1em 0;">商品詳細</h3>
   
  <table class="table-tabular" style="margin: 0 0 1.5em 0;">
    <thead>
      <tr>
        <th>数量</th>
        <th>商品名</th>
        {% if show_line_item_taxes %}
        <th>消費税</th>
        {% endif %}
        <th>価格</th>
      </tr>
    </thead>
    <tbody>
      <!-- Bold 1 -->
      {% assign hidden_variant_ids = "" %}
      {% for line in line_items %}
          {% for prop in line.properties %}
            {% if prop.first == "_boldVariantIds" %}
              {% assign hidden_variant_ids = hidden_variant_ids | append: prop.last | append: ',' %}
            {% endif %}
          {% endfor %}
      {% endfor %}
      <!-- Bold 1 -->
      {% for line_item in line_items %}
   
      <!-- Bold 2 -->
        {% assign variant_id = line_item.variant_id | append: "" %}
        {% if hidden_variant_ids contains variant_id %}{% continue %}{% endif %}
   
        {% assign bold_item_price = line_item.price %}
        {% assign bold_line_price = line_item.line_price %}
        {% assign bold_var_ids = "" %}
        {% assign price_index = "" %}
        {% assign bold_qtys = "" %}
            {% for prop2 in line_item.properties %}
                {% if prop2.first == "_boldVariantIds" %}
                    {% assign bold_var_ids = prop2.last | split: "," %}
                {% elsif prop2.first == "_boldVariantPrices" %}
                  {% assign price_index = prop2.last | split: "," %}
                {% elsif prop2.first == "_boldVariantQtys" %}
                  {% assign bold_qtys = prop2.last | split: "," %}
                {% endif %}
            {% endfor %}
   
                {% unless price_index == "" && bold_var_ids == "" %}
                {% for price in price_index %}
                  {% assign bold_qty = 1 %}
                  {% if bold_qtys.length > 0 %}{% assign bold_qty = bold_qtys[forloop.index0] %}{% endif %}
   
                  {% assign bold_item_price = bold_item_price | plus: price %}
                  {% assign temp_price = price | times: bold_qty %}
                  {% assign bold_line_price = bold_line_price | plus: temp_price %}
                {% endfor %}
                {% endunless %}
   
        {% assign bold_options = " " %}
   
        {% for bold_option in line_item.properties %}
            {% assign first_char = bold_option.first | slice: 0, 1 %}
            {% assign opt_title = bold_option | first %}
            {% assign opt_desc = bold_option | last %}
                {% unless first_char == '_' or first_char=='_boldOptionLocalStorageId' or bold_option.first == 'master_builder' or bold_option.first == 'builder_id' or bold_option.first == '_boldOptionLocalStorageId' or  bold_option.first == 'builder_info' or bold_option.last == "" %}
                  {% assign bold_options = bold_options | append: '<br />' | append: opt_title | append: ': ' | append: opt_desc %}
                {% endunless%}
        {% endfor %}
   
        {% assign bold_options = bold_options | prepend: '<span class="bold_options">' | append: "</span>" %}
        <!-- end Bold 2 -->
        <tr>
          <td>{{ line_item.quantity }} x</td>
          <td>
            <b>{{ line_item.title }}</b>
            {{ bold_options }}
          </td>
          {% if line_item.tax_lines %}
            <td>
              {% for tax_line in line_item.tax_lines %}
                {{ tax_line.price | money }} {{ tax_line.title }}<br/>
              {% endfor %}
            </td>
          {% endif %}
          <td>
            {% if line_item.original_price != line_item.price %}
              <s>{{ line_item.original_price | money }}</s>
            {% endif %}
            {{ bold_line_price | money }}
          </td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
   
  {% if transactions.size > 1 %}
    <h3 style="margin: 0 0 1em 0;">Transaction Details</h3>
    <table class="table-tabular" style="margin: 0 0 1.5em 0;">
      <thead>
        <tr>
          <th>Type</th>
          <th>Amount</th>
          <th>Kind</th>
          <th>Status</th>
        </tr>
      </thead>
      <tbody>
        {% for transaction in transactions %}
          <tr>
            <td>{{ transaction.gateway | payment_method }}</td>
            <td>{{ transaction.amount | money }}</td>
            <td>{{ transaction.kind }}</td>
            <td>{{ transaction.status }}</td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  {% endif %}
   
  <h3 style="margin: 0 0 1em 0;">支払い明細</h3>
   
  <table class="table-tabular" style="margin: 0 0 1.5em 0;">
    <tr>
      <td>総額:</td>
      <td>{{ subtotal_price | money }}</td>
    </tr>
    {% for discount in discounts %}
    <tr>
      <td>値引額 "{{ discount.code }}"</td>
      <td>{{ discount.savings | money }}</td>
    </tr>
    {% endfor %}
    <tr>
      <td>消費税総額:</td>
      <td>{{ tax_price | money }}</td>
    </tr>
    {% if shipping_address %}
      <tr>
        <td>送料:</td>
        <td>{{ shipping_price | money }}</td>
      </tr>
    {% endif %}
    <tr>
      <td><strong>合計金額:</strong></td>
      <td><strong>{{ total_price | money }}</strong></td>
    </tr>
    {% if total_paid != total_price %}
      <tr>
        <td><strong>総支払い額:</strong></td>
        <td><strong>{{ total_paid | money }}</strong></td>
      </tr>
      <tr>
        <td><strong>Outstanding Amount:</strong></td>
        <td><strong>{{ total_price | minus: total_paid | money }}</strong></td>
      </tr>
    {% endif %}
  </table>
   
  {% if note %}
    <h3 style="margin: 0 0 1em 0;">Note</h3>
    <p>{{ note }}</p>
  {% endif %}
   

 
  <p>If you have any questions, please send an email to <u>{{ shop.email }}</u></p>

 

 

1 件の受理された解決策

toooru
Shopify Partner
93 52 98

成功

以下のようにreplaceフィルターを使うことで可能ですのでご確認ください。

例)

{{ gateway | replace: "shopify_payments", "クレジットカード決済" }}

 複数の場合はパイプで区切ることで可能です。

例)

{{ gateway | replace: "shopify_payments", "クレジットカード決済" | replace: "Cash on Delivery (COD)", "代金引換" }}

 

元の投稿で解決策を見る

2件の返信2

toooru
Shopify Partner
93 52 98

成功

以下のようにreplaceフィルターを使うことで可能ですのでご確認ください。

例)

{{ gateway | replace: "shopify_payments", "クレジットカード決済" }}

 複数の場合はパイプで区切ることで可能です。

例)

{{ gateway | replace: "shopify_payments", "クレジットカード決済" | replace: "Cash on Delivery (COD)", "代金引換" }}

 

yuuka_saito
Shopify Partner
6 1 1

ありがとうございます!

こちらで対応できました。