Add compare at price to Order Printer template

Vibrant_Health_
New Member
3 0 6

We need to be able to indicate a sale in the invoice (set as a compare at price), especially as it’s not reflected on “view order” page. I tried adding {{ variant.compare_at_price | money }} and {{ line_item.compare_at_price | money }} in the order details section of the template, but neither work. It that this should be straightforward, as this is the primary way Shopify sets items on sale.

This exact code is in the template. See the last <td> -- these variables are in and not conditional, but they don't show any data.

<table class="table-tabular" style="margin: 0 0 1.5em 0; font-size: 0.8em;">
  <thead>
    <tr>
      <th>Quantity</th>
      <th>Item</th>
      {% if show_line_item_taxes %}
      <th>Taxes</th>
      {% endif %}
      <th>Price</th>
    </tr>
  </thead>
  <tbody>
    {% for line_item in line_items %}
      <tr
        <td>{{ line_item.quantity }} x</td>
        <td><b>{{ line_item.title }}</b>
        {% if line_item.title contains 'Green Vibrance' and line_item.title != 'Try a Sample - Green Vibrance Sample' %}
              | December Sale 25% Off
        {% endif %}</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>
        {{ variant.compare_at_price | money }}
        {{ line_item.compare_at_price | money }}
          <s>{{ line_item.compare_at_price | money }}</s>
          {% if line_item.original_price != line_item.price %}
            <s>{{ line_item.original_price | money }}</s>
          {% endif %}
          {{ line_item.price | money }}
          {% if line_item.original_price != line_item.price %}
            | Customer Tag Discount Applied
          {% endif %}
        </td>
      </tr>
    {% endfor %}
  </tbody>
</table>

 

0 Likes
Vibrant_Health_
New Member
3 0 6

I'm surprised to have not received any reply to this. I ended up figuring it out myself with fresh eyes -- the proper variable is:

 {{ line_item.variant.compare_at_price | money }}
        

 

pralad19
New Member
5 0 0
Thanks alot mate, you save me hours with just this small thread can you write up the full code as your previous one?
0 Likes