Liquid attribute for Customer's Phone number?

Highlighted
New Member
2 0 0

Hi there, I'm making a custom packing slip, and I can't figure out a way to include the customer's phone number which is very important because I don't use emails for shipping.

I have used all possible attributes like {{customer.phone}} and {{shipping_addresse.phone}} , but the one I'm looking for is the first field in the checkout form, you know where you either put email or phone

 

Screenshot_1.jpg

Here is the packing slip:

<div style="text-align: center" style="margin: 0 0 1.5em 0; padding: 1.5em; border: 1px solid black;">
  <img height="100px" class="center" src="https://cdn.shopify.com/s/files/1/0280/6061/4794/files/png-logo.png?v=1577993208">
  <strong>{{ shop.name }}<br>

// CUSTOMER PHONE NUMBER HERE

</strong><br/>
</div>
{% if shipping_address %}
<div style="padding: 1.5em; text-align: center; border: 1px solid black;">
  <h2 style="margin: 0 0 1em 0;">Commande #{{ order_number }}</h2>
  <strong>{{ shipping_address.name }}</strong><br/>
  {% if shipping_address.company %}
    {{ shipping_address.company }}<br/>
  {% endif %}
  {{ shipping_address.street }}
  {{ shipping_address.city }} {{ shipping_address.province_code }} <br/>
  <h2>{{ shipping_address.zip | upcase }}</h2>
</div>
{% endif %}
<br>
<table class="table-tabular" style="margin: 0 0 1.5em 0;">
  <tbody>
    {% for line_item in line_items %}
      <tr>
        <td>{{ line_item.quantity }} x</td>
        <td><b>{{ line_item.title }}</b></td>
        {% if line_item.tax_lines %}
          <td>
            {% for tax_line in line_item.tax_lines %}
              {{ tax_line.price | money }} {{ tax_line.title }}<br/>
            {% endfor %}
          </td>
        {% endif %}
        <td>
          {% if line_item.original_price != line_item.price %}
            <s>{{ line_item.original_price | money }}</s>
          {% endif %}
          {{ line_item.price | money }}
        </td>
      </tr>
    {% endfor %}
    
     {% if shipping_address %}
    <tr>
      <td>Livraison:</td>
      <td></td>
      <td>{{ shipping_price | money }}</td>
    </tr>
  {% endif %}
  <tr>
    <td><strong>Total:</strong></td>
    <td></td>
    <td><strong>{{ total_price | money }}</strong></td>
  </tr>
    
    
  </tbody>
</table>


<style>
.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
} </style>

 

0 Likes
Highlighted
Astronaut
1085 177 213

Hello,

If you want to add mandatory phone number to checkout you can do it through the settings, you don't have to use code. Check the screenshot below:

phone2.png

Let me know whether it helps you.

Kind regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes
Highlighted
New Member
2 0 0

Hey thanks for the reply

That doesn't solve my problem tho since it creates a second field at the bottom for shipping phone number

I however want to access the phone number in the customer's account (the one they put usually in the email field)

0 Likes
Highlighted
Astronaut
1085 177 213

I see. Have you tried accessing the value of that phone input you've added with {{form.phone}}?

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes