Alter packing slip code to show only adress, Hide country and country code for home country

Topic summary

A user wants to customize Shopify’s packing slip template for printing shipping labels, specifically to hide the country code “SE” for domestic Swedish orders while displaying it with a dash format (e.g., “SE-512 65”) for international shipments.

Two initial issues identified:

  • Modified template not applying when printing (standard template still used)
  • Need conditional logic to hide country code for Sweden

Solution provided:
Another user shared Liquid code using conditional logic ({% if shipping_address.country_code == 'SE' %}) to check if the country code is “SE” and display the address without it for Swedish orders, while showing the country code with a dash for all other countries.

Outcome:
The solution worked successfully. The original poster confirmed it functions with the Order Printer app, though noted the built-in packing slip function under the shipping menu doesn’t seem to work. They shared their complete working code for others who might need similar functionality for label printer workflows.

Summarized with AI on November 10. AI used: claude-sonnet-4-5-20250929.

Hi, I am planning to use the packing slip print function to print adresses easily to be used on letters with stamps.
The plan is to use a label printer, to make the shipping easier!

I have figured out how to do it, but i have two problems.

  1. I altered the template, but when i print it the shop uses the standard template anyways. Is this a known issue?

  2. For my native country I don’t want to show the country code before the zip or under the zip code.
    Can this be hidden for my country with a code string? Country is Sverige and country code SE
    Best would be that all other countries was shown in the format SE-512 65 with a dash too, is this possible?
    I am greatful for any help :slightly_smiling_face:

Thanks Gordon

      <p class="address-detail">
        {% if shipping_address != blank %}
          {{ shipping_address.name }}
          {% if shipping_address.company != blank %}
            <br>
            {{ shipping_address.company }}
          {% endif %}
          <br>
          {{ shipping_address.address1 }}
          {% if shipping_address.address2 != blank %}
            <br>
            {{ shipping_address.address2 }}
          {% endif %}
 {% if shipping_address.country_code != blank %}
            <br>
            {{ shipping_address.country_code }} {{ shipping_address.city_province_zip }}
{% endif %}
          <br>
          {{ shipping_address.country }}
          {% if shipping_address.phone != blank %}
            <br>
            {{ shipping_address.phone }}
          {% endif %}
        {% else %}
          Ingen leveransadress
        {% endif %}
      

Hi @GordonE

As you want to hide country code for your country “Sverige” and show for all the other countries
Can you try replacing the below line in your above code

{{ shipping_address.country_code }} {{ shipping_address.city_province_zip }}

with

{% if shipping_address.country_code == 'SE' %}
{{ shipping_address.city_province_zip }}
{% else %}
{{ shipping_address.country_code }}-{{ shipping_address.city_province_zip }}
{% endif %}

If this information was helpful to you, please give it a Like. If it resolved your issue, kindly hit Like and mark it as the Solution! Thank you!

1 Like

Thanks, that was over my skill level, so big thanks for that.
It worked out good and the code follows if anyone want to make the same!
This works with the order printer app, the packing slip function under the shipping menu does not seem to work, but mabe its just me.
But this i think will be good if i could got it printed out on a Lable printer and save me some time!

:slightly_smiling_face:

# 
        {% if shipping_address != blank %}
          {{ shipping_address.name }}
          {% if shipping_address.company != blank %}
            

            {{ shipping_address.company }}
          {% endif %}
          

          {{ shipping_address.address1 }}
          {% if shipping_address.address2 != blank %}
            

            {{ shipping_address.address2 }}
          {% endif %}
          

          
{% if shipping_address.country_code == 'SE' %}
{{ shipping_address.zip }} {{ shipping_address.city }}
{% else %}
{{ shipping_address.country_code }}-{{ shipping_address.zip }} {{ shipping_address.city }}
{% endif %}
          

               {% if shipping_address.country == 'Sweden' %} 

{% else %}
{{ shipping_address.country }}
{% endif %}
         
        {% endif %}