Grouping items on invoice by vendor

Solved
Highlighted
Tourist
4 0 1

Is there an easy solution, for a not so great coder, to group items on an invoice by vendor and have a total displayed for each vendor?

0 Likes
Highlighted
Shopify Partner
242 59 103

Hi @Matty206,

 

Welcome to the Shopify Community!

 

I understand that you want to group items on an invoice by vendor and have a total displayed for each vendor.

 

Is there an easy solution, for a not so great coder...

There's no easy solution for a not so great coder 😄

 

However, if you will copy/paste your invoice template here, I would be happy to help you with this.

 

Customize a specific email template:

  1. From your Shopify admin, go to Settings > Notifications.
  2. Click the name of the notification that you want to change.
  3. Copy the entire text of the Email body (HTML) box.
  4. Paste it here in a post on this thread.

 

Cheers!

Brian | Shopify Partner | Ecommerce Consultant
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution  
 - Need further assistance? Visit www.BrianAtWork.com

0 Likes
Highlighted
Tourist
4 0 1
<p style="float: right; text-align: right; margin: 0;">
  {{ "now" | date: "%m/%d/%y" }}<br />
  Invoice for {{ order_name }}
</p>

<div style="float: left; margin: 0 0 1.5em 0;" >
  <strong style="font-size: 2em;">{{ shop_name }}</strong><br /><br />
  {{ shop.address }}<br/>
  {{ shop.city }} {{ shop.province_code }} {{ shop.zip | upcase }}<br/>
  {{ shop.country }}
</div>

<hr />

<h3 style="margin: 0 0 1em 0;">Item Details</h3>


<table class="table-tabular" style="margin: 0 0 1.5em 0;">
  <thead>
    <tr>
      <th>Quantity</th>
      <th>Vendor</th>
      <th>Item</th>
      <th>Price</th>
    </tr>
  </thead>
  <tbody>
    {% for line_item in line_items %}
      <tr>
        <td>{{ line_item.quantity }} x</td>
        <td><b>{{ line_item.vendor }}</b></td>
        <td><b>{{ line_item.title }}</b></td>
        <td>
          {% if line_item.original_price != line_item.price %}
            <s>{{ line_item.original_price | money }}</s>
          {% endif %}
          {{ line_item.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;">Payment Details</h3>

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
  <tr>
    <td>Subtotal price:</td>
    <td>{{ subtotal_price | money }}</td>
  </tr>
  {% for discount in discounts %}
  <tr>
    <td>Includes discount "{{ discount.code }}"</td>
    <td>{{ discount.savings | money }}</td>
  </tr>
  {% endfor %}
  {% if shipping_address %}
    <tr>
      <td>Shipping:</td>
      <td>{{ shipping_price | money }}</td>
    </tr>
  {% endif %}
  <tr>
    <td><strong>Total price:</strong></td>
    <td><strong>{{ total_price | money }}</strong></td>
  </tr>
  {% if total_paid != total_price %}
    <tr>
      <td><strong>Total paid:</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 %}

{% if shipping_address %}
  <h3 style="margin: 0 0 1em 0;">Shipping Details</h3>

  <div style="margin: 0 0 1em 0; padding: 1em; border: 1px solid black;">
    <strong>{{ shipping_address.name }}</strong><br/>
    {% if shipping_address.company %}
      {{ shipping_address.company }}<br/>
    {% endif %}
    {{ shipping_address.street }}<br/>
    {{ shipping_address.city }}
    {{ shipping_address.province_code }}
    {{ shipping_address.zip | upcase }}<br/>
    {{ shipping_address.country }}
  </div>
{% endif %}

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

Thanks, Brian!

 

Here is what I have so far

 

 

0 Likes
Highlighted
Shopify Partner
242 59 103

This is an accepted solution.

Hey @Matty206,

 

Give this a try:

 

<p style="float: right; text-align: right; margin: 0;">
    {{ "now" | date: "%m/%d/%y" }}<br />
    Invoice for {{ order_name }}
  </p>
  
  <div style="float: left; margin: 0 0 1.5em 0;" >
    <strong style="font-size: 2em;">{{ shop_name }}</strong><br /><br />
    {{ shop.address }}<br/>
    {{ shop.city }} {{ shop.province_code }} {{ shop.zip | upcase }}<br/>
    {{ shop.country }}
  </div>
  
  <hr />
  
  <h3 style="margin: 0 0 1em 0;">Item Details</h3>
  
  <table class="table-tabular" style="margin: 0 0 1.5em 0;">
    <thead>
      <tr>
        <th>Quantity</th>
        <th>Vendor</th>
        <th>Item</th>
        <th>Price</th>
      </tr>
    </thead>
    <tbody>
      {% for line_item in line_items %}
        {% unless vendors_list contains line_item.vendor %}
          {% capture vendors_list %}{{ vendors_list }}{% endcapture %}
          {% assign vendors_list = vendors_list | append: line_item.vendor | append: "," %}
        {% endunless %}
      {% endfor %}
      {% assign size = vendors_list | size | minus: 1 %}
      {% assign vendors_list = vendors_list | slice: 0, size %}
      {% assign vendors_list = vendors_list | split: "," %}
      {% for vendor in vendors_list %}
        {% assign vendor_total = 0 %}
        {% for line_item in line_items %}
          {% if line_item.vendor == vendor %}
            <tr>
              <td>{{ line_item.quantity }} x</td>
              <td><b>{{ line_item.vendor }}</b></td>
              <td><b>{{ line_item.title }}</b></td>
              <td>
                {% if line_item.original_price != line_item.price %}
                  <s>{{ line_item.original_price | money }}</s>
                {% endif %}
                {{ line_item.price | money }}
                {% assign vendor_total = vendor_total | plus: line_item.price %}
              </td>
            </tr>
          {% endif %}
        {% endfor %}
        <tr>
          <td></td>
          <td></td>
          <td><b><u>{{ vendor }} subtotal:</u></b></td>
          <td>{{ vendor_total | 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;">Payment Details</h3>
  
  <table class="table-tabular" style="margin: 0 0 1.5em 0;">
    <tr>
      <td>Subtotal price:</td>
      <td>{{ subtotal_price | money }}</td>
    </tr>
    {% for discount in discounts %}
    <tr>
      <td>Includes discount "{{ discount.code }}"</td>
      <td>{{ discount.savings | money }}</td>
    </tr>
    {% endfor %}
    {% if shipping_address %}
      <tr>
        <td>Shipping:</td>
        <td>{{ shipping_price | money }}</td>
      </tr>
    {% endif %}
    <tr>
      <td><strong>Total price:</strong></td>
      <td><strong>{{ total_price | money }}</strong></td>
    </tr>
    {% if total_paid != total_price %}
      <tr>
        <td><strong>Total paid:</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 %}
  
  {% if shipping_address %}
    <h3 style="margin: 0 0 1em 0;">Shipping Details</h3>
  
    <div style="margin: 0 0 1em 0; padding: 1em; border: 1px solid black;">
      <strong>{{ shipping_address.name }}</strong><br/>
      {% if shipping_address.company %}
        {{ shipping_address.company }}<br/>
      {% endif %}
      {{ shipping_address.street }}<br/>
      {{ shipping_address.city }}
      {{ shipping_address.province_code }}
      {{ shipping_address.zip | upcase }}<br/>
      {{ shipping_address.country }}
    </div>
  {% endif %}
  <p>If you have any questions, please send an email to <u>{{ shop.email }}</u></p>

Let me know if this solves your problem or if you need further help!

Brian | Shopify Partner | Ecommerce Consultant
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution  
 - Need further assistance? Visit www.BrianAtWork.com

0 Likes
Highlighted
Tourist
4 0 1

Hi Brain

 

This is incredible! Thanks!!!

1 Like