Show Tracking Number on Order History

Solved
Highlighted
New Member
8 0 0

Hi Everyone, 

 

I want to show Shipping method & tracking number on the order history table, by doing this, customers can immediately see the shipping method & tracking number for each order in the order history list.

 

Is this possible?

thank you

0 Likes
Highlighted
Shopify Partner
1159 31 204

@ariesto refer https://shopify.dev/docs/themes/liquid/reference/objects/order#order-shipping_methods

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Available for hiring. lixon@ecommercestudio.in
0 Likes
Highlighted
New Member
8 0 0

@Lixon_Louis Thank you,

 

So, I tried to edit customer/account.liquid

 

         {%- if customer.orders.size != 0 -%}
            {%- paginate customer.orders by 20 -%}
               <table class="responsive-table orders-table">
                  <thead>
                    <tr>
                      <th scope="col">{{ 'customer.orders.order_number' | t }}</th>
                      <th scope="col">{{ 'customer.orders.date' | t }}</th>
                      <th scope="col">{{ 'customer.orders.payment_status' | t }}</th>
                      <th scope="col">{{ 'customer.orders.fulfillment_status' | t }}</th>
                      <th scope="col">{{ 'customer.orders.total' | t }}</th>
                    </tr>
                  </thead>
                  <tbody>
                    {%- for order in customer.orders -%}
                      <tr>
                        <th data-label="{{ 'customer.orders.order_number' | t }}" scope="row">
                          <a href="{{ order.customer_url }}" class="btn btn--secondary btn--small js_add_ld" aria-label="{{ 'customer.orders.order_number_link' | t: number: order.name }}">{{ order.name }}</a>
                        </th>
                        <td data-label="{{ 'customer.orders.date' | t }}">{{ order.created_at | time_tag: format: 'date' }}</td>
                        <td data-label="{{ 'customer.orders.payment_status' | t }}">{{ order.financial_status_label }}</td>
                        <td data-label="{{ 'customer.orders.fulfillment_status' | t }}">{{ order.fulfillment_status_label }}</td>
                        <td data-label="{{ 'customer.orders.total' | t }}">{{ order.total_price | money_with_currency }}</td>
                      </tr>
                    {%- endfor -%}
                  </tbody>
               </table>
              {%- if paginate.pages > 1 -%}{% render 'pagination', paginate: paginate, cl_a:' js_add_ld' %}{%- endif -%}
            {%- endpaginate -%}
         {%- else -%}
            <div class="shopify-message"><i class="facl facl-ok"></i><a class="btn_link fwsb tu mr__10" href="{{routes.all_products_collection_url | sort_by: 'best-selling'}}">{{ 'customer.make_order' | t }}</a> {{ 'customer.orders.none' | t }}</div>
         {%- endif -%}

 

 

And put this code for table column heading

<th scope="col">{{ 'customer.orders.shipping_method' | t }}</th>

and this for table content

<td data-label="{{ 'customer.orders.shipping_method' | t }}">{{ fulfillment.tracking_number }}</td>

but the tracking number data does not appear.

screenshot-sei-lamalera.myshopify.com-2020.06.03-12_14_55.png

 

I am still new in coding, please advise thank you

0 Likes
Highlighted
Shopify Partner
1159 31 204

This is an accepted solution.

Try these instead @ariesto 

 

 <th>Shipping Method</th>
<td> 
    {%- for line_item in order.line_items -%}
        <div>
            {{ line_item.fulfillment.tracking_company }}
            {%- if line_item.fulfillment.tracking_number -%} #{{ line_item.fulfillment.tracking_number }} {%- endif -%}
        </div>
    {%- endfor -%}
</td>

 

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Available for hiring. lixon@ecommercestudio.in
1 Like
Highlighted
New Member
8 0 0

@Lixon_Louis It's work, thanks!

0 Likes