How to add product name in My Account order history table

Hi there,

How to add the product name in the order history table in My Account page? I was able to add the title Product row in the table but not able to add the code to get the relevant product name in the order history table.


{% for order in customer.orders %}

{% endfor %}
<table>

<tr>

<th>

{{ 'customer.orders.order_number' | t }}

</th>

<th>

{{ 'customer.order.product' | t }}

</th>

<th>

{{ 'customer.orders.date' | t }}

</th>

<th>

{{ 'customer.orders.payment_status' | t }}

</th>

<th>

{{ 'customer.orders.total' | t }}

</th>

</tr>

<tr>

<td>

{{ order.name | link_to: order.customer_url }}

</td>

<td>

{{ order.created_at | date: format: 'date' }}

</td>

<td>

{{ order.financial_status_label }}

</td>

<td>

{{ order.total_price | money }}

</td>

</tr>

</table>

Thanks in advance guys :slightly_smiling_face:

Shopify allows to add product name in the order history table. On the left panel in your Shopify admin, click on Sales Reports. Select a product and click the edit pencil icon. Now on the right panel, you will find two options: Order Statistic and Order Detail. Click on the Order Detail and fill up the order name field. Save changes to add product name in your order history table.

Hi @rajj99 [email removed] try

customer.order.product_title

I may be wrong. But just give it a try

Thanks a lot for your time, but thats not working :slightly_smiling_face:

can u try again?

@rajj99

try

customer.order.product.title

I took the reference from here

Shopify Tutorial: The product.liquid template — Learning Liquid

Edit: I checked the date on the above shopify info post. It’s from way back in 2016. So I’m not sure if it’s gonna work.

Try referring to these two posts

Retrieve customer order product ID Shopify - Stack Overflow

how to call customer product name or ID list - Shopify Community

Thanks for your efforts bro, but it seems to be not working.

Not sure how shopify did not address this issue.

@KetanKumar Please look into above.

@rajj99

can you try this code


{% for order in customer.orders %}

{% endfor %}

| {{ 'customer.orders.order_number' | t }} | {{ 'customer.order.product' | t }} | {{ 'customer.orders.date' | t }} | {{ 'customer.orders.payment_status' | t }} | {{ 'customer.orders.total' | t }} |
| - | - | - | - | - |
| {{ order.name | link_to: order.customer_url }} | {{ line_item.title | link_to: line_item.product.url }} | {{ order.created_at | date: format: 'date' }} | {{ order.financial_status_label }} | {{ order.total_price | money }} |

@KetanKumar Its showing blank, can you look into it pls.

@rajj99

can you please share store url and your user login details

hello @rajj99

here is the perfect solution for displaying product title in order table


{% for order in customer.orders %}

{% endfor %}

| {{ 'customer.orders.order_number' | t }} | {{ 'customer.order.product' | t }} | {{ 'customer.orders.date' | t }} | {{ 'customer.orders.payment_status' | t }} | {{ 'customer.orders.total' | t }} |
| - | - | - | - | - |
| {{ order.name | link_to: order.customer_url }} | {%- for line_item in order.line_items -%}<br>{{ line_item.title | link_to: line_item.product.url }}<br>{%- endfor -%} | {{ order.created_at | date: format: 'date' }} | {{ order.financial_status_label }} | {{ order.total_price | money }} |

Hi,

Did you ever get this to work?