# Order printerに関して

**URL:** <https://community.shopify.com/t/order-printer/232550>\
**Category:** Shopify アプリ\
**Created:** [July 13, 2023, 11:54pm UTC](https://community.shopify.com/t/order-printer/232550 "2023-07-13T23:54:01Z")\
**Posts on this page:** 2\
**Page:** 1

## AI-generated summary

**問題の概要:**
Order printerアプリでバッチ印刷時に、ランダムなオーダーが2ページに分割されて印刷される不具合が発生。単体でオーダーを印刷する場合は正常に1ページに収まる。

**提供された情報:**
- Order printerのテンプレートコードが投稿されている
- コードには注文番号、注文日時、配送先情報、注文者情報、配送方法/料金、合計金額、注文指定日などの表示項目が含まれる
- CSSスタイリングとLiquidテンプレート構文が使用されている
- 返金処理や明細行の処理ロジックも実装されている

**現状:**
議論は問題提起とコード共有の段階で、解決策や原因の特定には至っていない。バッチ印刷時の改ページ制御に関する技術的な問題と思われる。

<div class="post-metadata">

**Author:** ![wasabi33](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@wasabi33](https://community.shopify.com/u/wasabi33)\
**Post date:** [July 13, 2023, 11:54pm UTC](https://community.shopify.com/t/order-printer/232550/1 "2023-07-13T23:54:01Z")

</div>

現在Shopify appのOrder printerを使って出荷用の伝票を印刷していますが、バッチで複数のオーダーを同時に印刷する際に、ランダムなオーダーにて注文が1ページに表示されずに、２ページに分かれて印刷されてしまうことがあります。

オーダー自体を単体で選択肢印刷すると通常通り一枚に印刷されすのですがこれを修正する方法は有りますでしょうか？

---

<div class="post-metadata">

**Author:** ![wasabi33](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@wasabi33](https://community.shopify.com/u/wasabi33)\
**Post date:** [July 13, 2023, 11:57pm UTC](https://community.shopify.com/t/order-printer/232550/2 "2023-07-13T23:57:10Z")

</div>

下記がOrder printerの表示内容のコードです。

{% assign total\_refunds = 0.0 %} {% for transaction in refund\_transactions %} {% if transaction.status == "success" %} {% assign total\_refunds = total\_refunds | plus: transaction.amount %} {% endif %} {% endfor %}

| 注文番号 | **{{ order\_name }}** |
| 注文日時 | {{ created\_at }} |
| 配送先情報 | 〒{{ shipping\_address.zip | upcase }}  
{{ shipping\_address.province }}{{ shipping\_address.city }}{{ shipping\_address.street }}  
{% if shipping\_address.company %}{{ shipping\_address.company }}  
{% endif %} {{ shipping\_address.phone }}  
{{ shipping\_address.name }} |
| 注文者情報 | 〒{{ billing\_address.zip | upcase }}  
{{ billing\_address.province }}{{ billing\_address.city }}{{ billing\_address.street }}  
{% if billing\_address.company %}{{ billing\_address.company }}  
{% endif %} {{ billing\_address.phone }}  
{{ billing\_address.name }} |
| 配送方法 / 配送料 | {{ shipping\_method.title }} / {{ shipping\_price | money }} |
| 注文合計金額(送料別) | {{ subtotal\_price | minus: total\_refunds | money }} |
| 注文指定日 | {% if attributes.uchuyayamatodatepicker %}{{ attributes.uchuyayamatodatepicker }}{% else %}---{% endif %} |
| 注文指定時間 | {% if attributes.uchuyayamatoshippingtime %}{{ attributes.uchuyayamatoshippingtime }}{% else %}---{% endif %} |
| 注文備考 | {% if note %}{{ note }}{% else %}---{% endif %} |

## 商品情報
{% assign refunded\_items = "" %} {% for refund in refunds %} {% for refund\_line\_item in refund.refund\_line\_items %} {% assign refunded\_items = refunded\_items | append: refund\_line\_item.line\_item\_id | append: ':' | append: refund\_line\_item.quantity | append: ','%} {% endfor %} {% endfor %} {% assign refunded\_items\_array = refunded\_items | split: ',' %}

{% for line\_item in line\_items %}

{% assign non\_refunded\_quantity = line\_item.quantity %}  
{% assign line\_item\_id = line\_item.id | append: ‘’ %}  
{% if refunded\_items contains line\_item\_id %}  
{% for refunded\_item in refunded\_items\_array %}  
{% assign split\_refunded\_item = refunded\_item | split: ‘:’%}  
{% if split\_refunded\_item.first == line\_item\_id %}  
{% assign non\_refunded\_quantity = line\_item.quantity | minus: split\_refunded\_item.last %}  
{% endif %}  
{% endfor %}  
{% endif %}  
{% if non\_refunded\_quantity == 0 %}{% continue %}{% endif %}

{% endfor %}

| JAN | 商品 / 単価 | 数量 | 熨斗 |
| --- | --- | --- | --- |
| {{ line\_item.sku }} | {{ line\_item.title }}  
{% if line\_item.original\_price != line\_item.price %} ~~{{ line\_item.original\_price | money }}~~ {% endif %} {{ line\_item.price | money }} | {{ non\_refunded\_quantity }} | {% for property in line\_item.properties %}{{ property.first }}: {{ property.last }}  
{% endfor %} |

h2.title { font-size: 16px; font-weight: bold; color: #000; line-height: 1.2; margin: 0; padding: 10px 0; } .order\_info, .picking\_info { width: 100% !important; border-top: 1px solid #999 !important; border-left: 1px solid #999 !important; box-sizing: border-box; margin: 0 0 10px 0; } .order\_info th, .picking\_info th { border-bottom: 1px solid #999 !important; border-right: 1px solid #999 !important; padding: 10px; font-size: 13px; line-height: 1.5; color: #000; box-sizing: border-box; font-weight: bold; text-align: center; } .order\_info td, .picking\_info td { border-bottom: 1px solid #999 !important; border-right: 1px solid #999 !important; padding: 10px; font-size: 13px; line-height: 1.5; color: #000; box-sizing: border-box; } .order\_info td:nth-child(odd) { width: 24%; } .order\_info td:nth-child(even) { width: 76%; } .picking\_info th:nth-child(1) { width: 24%; } .picking\_info th:nth-child(2) { width: 32%; } .picking\_info th:nth-child(3) { width: 10%; } .picking\_info th:nth-child(4) { width: 34%; } .order\_info td b { font-size: 16px; font-weight: bold; letter-spacing: 1px; }
