Join our new Facebook group, Nonprofit Salesforce Users!

Drop Ship Purchase Order Template for Shopify Order Printer

You can create a purchase order using a new template in the Order Printer app by Shopify.  You can create a purchase order specifically for drop shipped items from any wholesaler.  Here we are going to order an area rug selected by the customer with the variant of the rug size.

Once you create the new purchase order template you can use a metafield value right from the product page including product variants.  Reference the value this way.  (our metafield is vendor.Cost and is set at the variant level).  We also use vendor.itemno for the vendor's item number.   Just set it on the product page and use it in the purchase order.

 

Display the unit cost:

 {{ line_item.variant.metafields.Cost.value   }} 

Obviously you will need to multiply the cost by the quantity

{% assign VC = (line_item.variant.metafields.Cost.value | times: line_item.quantity) %}

Now let's get it in the right format for currency display:

{{ VC | times: 100 | money }}

Don't forget we have to total the line item cost:

{% assign TOT = (TOT | plus: VC) %}

Voila!

 _____________________________________________________________________

ADDED:  Here is the full code of our purchase orders which print a separate purchase order for each vendor that supplies items in the order line items (specifically designed for drop shipping from multiple manufacturers who do not fit the standard "fulfilment" model of many Shopify apps).  The requirements are that you have metafields at the variant and product level  Itemno and Cost (case sensitive).  If a variant has no additional cost just do not include those metafields at the variant level (i.e. blue does not cost more than red) and the code will pick up the cost at the product level.  Just go to order printer, create a new template and name it purchase order and plunk the following code in.  It will display as one long page but when printed (even printing to pdf)  it will split the pages.

What is happening in the code is that an array is created right away that is all of the vendors (one for each line item) but because we use 'uniq' duplicates are removed.

Prints the header info for the first vendor.  Iterates through the line items to see if the line item vendor is the same as the current array index vendor.  If it is, then print the line and tally up the cost for that purchase order total.

After printing the footer area of the purchase order do a printer break.

Loop to the next vendor and repeat.

The total for the purchase order gets reset to 0 every time a new vendor is retreived from the Vendor array.

 

{% assign VendArray = line_items | map: 'vendor' | uniq %}


{% for currVendor in VendArray %}
{% assign TOT = 0 %}
<p style="float: right; text-align: right; margin: 0;">
{{ "now" | date: "%m/%d/%y" }}<br />
Purchase Order: {{ order_name }}<br />
Vendor: {{ currVendor }}
<br />

</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>Item No.</th>
<th>Item</th>
<th>Unit Cost</th>
<th>Total</th>
</tr>
</thead>
<tbody>
{% for line_item in line_items %}
{% if line_item.vendor == currVendor %}

<tr>
<td>{{ line_item.quantity }} </td>

<td>
{% if line_item.variant.metafields.Itemno != blank %}
{{ line_item.variant.metafields.Itemno.value }}
{% else %}
{{ line_item.product.metafields.Itemno.value }}
{% endif %}
</td>
<td><b>{{ line_item.title }}</b></td>
<td>
{% if line_item.variant.metafields.Cost != blank %}
$ {{ line_item.variant.metafields.Cost.value }}
{% assign VC = (line_item.variant.metafields.Cost.value | times: line_item.quantity) %}
{% else %}
$ {{ line_item.product.metafields.Cost.value }}
{% assign VC = (line_item.product.metafields.Cost.value | times: line_item.quantity) %}
{% endif %}
</td>
<td>
{{ VC | times: 100 | money }}
</td>
{% assign TOT = (TOT | plus: VC) %}
</tr>
{% endif %}
{% 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 %}

<table width="100%" style="margin: 0 0 1.5em 0;">
<tr align="right">
<td><strong>Total: {{ TOT | times: 100 | money }}</strong></td>
</tr>

</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 style="page-break-after: always;">If you have any questions, please send an email to <u>{{ shop.email }}</u></p>
{% endfor %}

 

 

 

 

 

 

 


Leave a comment

Please note, comments must be approved before they are published