Re: Eliminate Space Between Variants on Packing Slip

Eliminate Space Between Variants on Packing Slip

fixthisbuildtha
Visitor
2 0 0

Hi, all.  I want my packing slips to be streamlined and only list the variants under the line item product instead of relisting the product each time.  I've been able to eliminate the product names, but the space they were occupying is still there.

 

Here is my current code for this section and how it looks.  Any advice on how to get rid of those big spaces?  1 hour with ChapGPT didn't get me there 🙂

 

Big spaces:

fixthisbuildtha_0-1690867959891.png

 

This is the code that eliminates the extra product names, but leaves the spaces:

{% assign previous_title = "" %}

{% for line_item in line_items_in_shipment %}
<div class="flex-line-item">
<div class="flex-line-item-description">
<p>
{% if line_item.title != previous_title %}
<span class="line-item-description-line">
<strong>{{ line_item.title }}</strong>
</span>
{% endif %}
{% if line_item.variant_title != blank %}
<span class="line-item-description-line">
{{ line_item.variant_title }}
</span>
{% endif %}
{% if line_item.sku != blank %}
<span class="line-item-description-line">
{{ line_item.sku }}
</span>
{% endif %}
</p>
</div>
<div class="flex-line-item-quantity">
<p class="text-align-right">
{{ line_item.shipping_quantity }} of {{ line_item.quantity }}
</p>
</div>
</div>
{% assign previous_title = line_item.title %}
{% endfor %}

 

 

 

Replies 3 (3)

Moeed
Shopify Partner
5519 1496 1787

Hey @fixthisbuildtha 
Kindly share your Store URL and Password if enabled also please share the link where this section is visible

- Need a Shopify Specialist? Chat on WhatsApp

- Custom Design | Advanced Coding | Store Modifications


fixthisbuildtha
Visitor
2 0 0

This is on the packing slips when I am printing them for shipping.  It's not publicly displayed anywhere and is different for each order.

Metz
Shopify Partner
10 0 0

While I'm new to the Liquid language, I'm wondering if the extra line can be eliminated with whitespace control as noted in this article.

 

"If you don’t want any of your tags to print whitespace, as a general rule you can add hyphens to both sides of all your tags ({%- and -%})"
https://shopify.github.io/liquid/basics/whitespace/

Hopefully this helps.

 

Can I ask if you have you been able to get the skus to print for each item in your bundle? Are you using a specific bundle app? I came across your post while searching for the solution to this issue.