Issue With Migration to Shopify Order Printer

Hi,

Hope someone is able to assist me.

Been trying to rectify the issue with order printer code for over two months.

If i view these two codes separately and on individual invoices it seems to be perfect but as soon as I want to use print both the packing slip and the invoice information seems missing as well as format changes.

Invoice code

{{ "now" | date: "%m/%d/%y" }}
Invoice for {{ order.order_name }}

{{ shop.address.address1 }}
{{ shop.address.city }} {{ shop.address.province_code }} {{ shop.address.zip | upcase }}
{{ shop.address.country }} {{ shop.phone_number }}

Item Details

{% if order.tax_lines.size > 0 %} {% endif %} {% # - Shopify migration: replicating behaviour of line_items variable %} {% assign shopify_migrated_refunded_line_items = refunds | map: "refund_line_items" | map: "line_item" %} {% assign shopify_migrated_line_items = order.line_items | concat: shopify_migrated_refunded_line_items | concat: order.tip_line_items | uniq %} {% for line_item in shopify_migrated_line_items %} {% if line_item.tax_lines.size > 0 %} {% endif %} {% endfor %}
Quantity Item DescriptionTaxesPrice
{{ line_item.quantity }} x {{ line_item.product.featured_image | product_img_url: 'thumb' | img_tag }} {{ line_item.title }} {% for tax_line in line_item.tax_lines %} {{ tax_line.price | money }} {{ tax_line.title }}
{% endfor %}
{{ line_item.price | money }}

{% if order.transactions.size > 1 %}

Transaction Details

{% for transaction in order.transactions %} {% endfor %}
Type Amount Kind Status
{{ transaction.gateway | payment_method }} {{ transaction.amount | money }} {{ transaction.kind }} {{ transaction.status }}
{% endif %}

Payment Details

{% for discount in order.discounts %} {% endfor %} {% if order.shipping_address %} {% endif %} {% if order.net_payment != order.total_price %} {% endif %}
Payment Method: {{ order.gateway }} {{ transaction.kind }}
Subtotal price: {{ order.subtotal_price | money }}
Includes discount "{{ discount.title }}" {{ discount.savings | money }}
Total tax: {{ order.tax_price | money }}
Shipping: {{ order.shipping_price | money }}
Total price: {{ order.total_price | money }}
Total paid: {{ order.net_payment | money }}
Outstanding Amount: {{ order.total_price | minus: order.net_payment | money }}

{% if order.note %}

Note

{{ order.note }}

{% endif %}

{% if order.shipping_address %}

Shipping Details

{{ order.shipping_address.name }}
{% if order.shipping_address.company %} {{ order.shipping_address.company }}
{% endif %} {{ order.shipping_address.street }}
{{ order.shipping_address.city }} {{ order.shipping_address.province_code }} {{ order.shipping_address.zip | upcase }}
{{ order.shipping_address.country }}
{% endif %}

{% for attribute in order.attributes %}
{% capture key %}{{ attribute | first }}{% endcapture %}
{% if key == ‘Checkout-Method’ or key == ‘Pickup-Location-Id’ %}
{% comment %}Display nothing{% endcomment %}
{% elsif key == ‘Pickup-Date’ %}
Pickup Date: {{ attribute | last }}
{% elsif key == ‘Pickup-Time’ %}
Pickup Time: {{ attribute | last }}
{% elsif key == ‘Delivery-Date’ %}
Delivery Date: {{ attribute | last }}
{% elsif key == ‘Delivery-Time’ %}
Delivery Time: {{ attribute | last }}
{$ else %}
{{ attribute | first }}: {{ attribute | last }}
{% endif %}
{% endfor %}

Returns & Refunds

Please ensure that you are completely satisfied with ALL the goods delivered to you.

Perishable Goods:

If you are for any reason dissatisfied with any perishable goods (i.e. Fresh Fruit & Vegetables, Milk, Bread etc.) purchased online, you may return it within 3 days of purchase for a full refund, replacement, store credit or exchange, provided you have the original tax invoice. Due to the nature of Perishable Goods, we do not accept further returns or exchanges once the 3 day period has lapsed.

Non-Perishable Goods:

If you are for any reason dissatisfied with any non- perishable goods (i.e. Canned Goods, Detergents, Cereals etc.) purchased online, you may return it within 7 days of purchase for a full refund, replacement, store credit or exchange, provided you have the original tax invoice. Once the 7 day period has lapsed we will exchange or provide store credit on non-perishable items up to 30 days after the date of purchase.

If you have any questions, please send an email to {{ shop.email }}

Packing slip code

{% if order.shipping_address %}

Order Number: {{ order.order_number }}

<h4 style="margin: 0 0 0.5em 0;"Payment Method: {{ order.gateway }}

Notes: {{ order.note }}

Phone No.: {{ order.shipping_address.phone }}

Recipient: {{ order.shipping_address.name }}

{% if order.shipping_address.company %} {{ order.shipping_address.company }}
{% endif %} {{ order.shipping_address.street }}
{{ order.shipping_address.city }} {{ order.shipping_address.province_code }} {{ order.shipping_address.zip | upcase }}
{{ order.shipping_address.country }}{% for attribute in order.attributes %} {% capture key %}{{ attribute | first }}{% endcapture %} {% if key == 'Checkout-Method' or key == 'Pickup-Location-Id' %} {% comment %}Display nothing{% endcomment %} {% elsif key == 'Pickup-Date' %} Pickup Date: {{ attribute | last }} {% elsif key == 'Pickup-Time' %} Pickup Time: {{ attribute | last }} {% elsif key == 'Delivery-Date' %} Delivery Date: {{ attribute | last }} {% elsif key == 'Delivery-Time' %} Delivery Time: {{ attribute | last }} {$ else %} {{ attribute | first }}: {{ attribute | last }} {% endif %} {% endfor %} {% for attribute in order.attributes %} {% capture key %}{{ attribute | first }}{% endcapture %} {% if key == 'Checkout-Method' or key == 'Pickup-Location-Id' %} {% comment %}Display nothing{% endcomment %} {% elsif key == 'Pickup-Date' %} Pickup Date: {{ attribute | last }} {% elsif key == 'Pickup-Time' %} Pickup Time: {{ attribute | last }} {% elsif key == 'Delivery-Date' %} Delivery Date: {{ attribute | last }} {% elsif key == 'Delivery-Time' %} Delivery Time: {{ attribute | last }} {$ else %} {{ attribute | first }}: {{ attribute | last }} {% endif %} {% endfor %}
{% endif %}

Sender: {{ shop.name }}

{{ shop.address.address1 }}
{{ shop.address.city }} {{ shop.address.province_code }} {{ shop.address.zip | upcase }}
{{ shop.address.country }}

Thank you

It looks like there might be conflicts when combining the invoice and packing slip codes. Try integrating both into one template by ensuring each section is properly enclosed and separated.


    {{ "now" | date: "%m/%d/%y" }}

    Invoice for {{ order.order_name }}
  

  
    

      {{ shop.address.address1 }}

      {{ shop.address.city }} {{ shop.address.province_code }} {{ shop.address.zip | upcase }}

      {{ shop.address.country }}

      {{ shop.phone_number }}
    

  

  

---

{% if order.shipping_address %}
  
    #### Order Number: {{ order.order_number }}
    #### Payment Method: {{ order.gateway }}
    #### Notes: {{ order.note }}
    #### Phone No.: {{ order.shipping_address.phone }}
    #### Recipient: {{ order.shipping_address.name }}
    {% if order.shipping_address.company %}
    {{ order.shipping_address.company }}

    {% endif %}
    {{ order.shipping_address.street }}

    {{ order.shipping_address.city }} {{ order.shipping_address.province_code }} {{ order.shipping_address.zip | upcase }}

    {{ order.shipping_address.country }}
    {% for attribute in order.attributes %}
    {% capture key %}{{ attribute | first }}{% endcapture %}
    {% if key == 'Checkout-Method' or key == 'Pickup-Location-Id' %}
    {% comment %}Display nothing{% endcomment %}
    {% elsif key == 'Pickup-Date' %}
    Pickup Date: {{ attribute | last }}
    {% elsif key == 'Pickup-Time' %}
    Pickup Time: {{ attribute | last }}
    {% elsif key == 'Delivery-Date' %}
    Delivery Date: {{ attribute | last }}
    {% elsif key == 'Delivery-Time' %}
    Delivery Time: {{ attribute | last }}
    {% else %}
    {{ attribute | first }}: {{ attribute | last }}
    {% endif %}
    {% endfor %}
  

  {% endif %}

    #### Sender: {{ shop.name }}
    {{ shop.address.address1 }}

    {{ shop.address.city }} {{ shop.address.province_code }} {{ shop.address.zip | upcase }}

    {{ shop.address.country }}
  

Thank you for the response.

how do I create a page break to separate the templates