Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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.
<div class="table-wrap">
<table class="full">
<thead>
<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>
</thead>
<tbody>
{% for order in customer.orders %}
<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>
{% endfor %}
</tbody>
</table>
</div>
Thanks in advance guys 🙂
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 @, 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 🙂
can u try again?
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.
can you try this code
<div class="table-wrap">
<table class="full">
<thead>
<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>
</thead>
<tbody>
{% for order in customer.orders %}
<tr>
<td>{{ order.name | link_to: order.customer_url }}</td>
<td>{{ line_item.title | link_to: line_item.product.url }}</td>
<td>{{ order.created_at | date: format: 'date' }}</td>
<td>{{ order.financial_status_label }}</td>
<td>{{ order.total_price | money }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
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
<div class="table-wrap">
<table class="full">
<thead>
<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>
</thead>
<tbody>
{% for order in customer.orders %}
<tr>
<td>{{ order.name | link_to: order.customer_url }}</td>
<td>{%- for line_item in order.line_items -%}
{{ line_item.title | link_to: line_item.product.url }}
{%- endfor -%}</td>
<td>{{ order.created_at | date: format: 'date' }}</td>
<td>{{ order.financial_status_label }}</td>
<td>{{ order.total_price | money }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
Hi,
Did you ever get this to work?
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024