Re: Adding each item's price & weight on Packing Slip

Adding each item's price & weight on Packing Slip

Amir212
New Member
5 0 0

Hello,

 

I was able to add item price on the packing slip with the code below, but it shows ALL prices under each item (repetitive).

Can you please help on adding prices & weight on the packing slip?

 

{% for item in order.line_items %}
{% if item.sku == line_item.sku %}
<span class="line-item-description-line">
{{ item.final_price | money }}
</span>
{% endif %}
{% endfor %}

Replies 5 (5)

BSS-Commerce
Shopify Partner
3478 465 559

Hi @Amir212 

You can try one of them: 

{% for item in order.line_items %}
    {% if item.sku != line_item.sku %}
        <span class="line-item-description-line">
            {{ item.final_price | money }}
            {{ item.weight | weight }}
        </span>
    {% endif %}
{% endfor %}

or

{% for item in order.line_items %}
{% if item.sku != prev_sku %}
<tr>
<td>{{ item.final_price | money }}</td>
<td>{{ item.weight }}</td>
</tr>
{% set prev_sku = item.sku %}
{% endif %}
{% endfor %}

I hope it helps @Amir212 !

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


Product Labels by BSS | B2B Solution & Custom Pricing


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
Amir212
New Member
5 0 0

Hello,

Thank you for the input, but both didn't work.

 

I was able to add item price with this code (just in case anyone else needs to):

</p>
{% assign final_price = nil %}
{% assign line_name = line_item.title %}
{% if line_item.variant_title != blank %}
{% assign line_name = line_name | append: " - " | append: line_item.variant_title %}
{% endif %}
{% for item in order.line_items %}
{% assign order_name = item.title %}
{% if order_name == line_name %}
{% assign final_price = item.final_price %}
{% endif %}
{% endfor %}
{% if final_price %}
{{ final_price | money }}
{% endif %}
</div>

 

If anyone can help with adding the weight that would be great!

BSS-Commerce
Shopify Partner
3478 465 559

Hey @Amir212 ,

When I follow this Shopify documentation: https://shopify.dev/docs/api/liquid/objects/line_item
I realize that you can retrieve the weight by using the variant's weight property.

Here's the code snippet:

{% assign final_price = item.final_price %}
{% assign weight = item.variant.weight %}
{{ weight }}


I hope this helps! If it works for you, please mark it as a solution. I am very happy for that. Have a great day!

 

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


Product Labels by BSS | B2B Solution & Custom Pricing


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
salman26
Visitor
2 0 0

Can you please tell me the exact place in the template where we should put this code?

 

7FINS
Visitor
1 0 0

I'd like to know this too, please.  I am having a hard time showing the weight.  It just says 0.0 oz all the time and also that quantity does not line up.  Please help.

 

screenshot of problem