Skip to main content
Solved

WooCommerce Order confirmation - how to not loop everything?


Forum|alt.badge.img

Hi,

I have a problem where shipping method and total cost gets looped on every item.

Tried using a separate table but it still loop it for every product.

 

Best answer by emma.owens

Hi ​@Andreas Furuskog ! 

Thank you for reaching out to the Community! Were you able to resolve this? 

If you are using a dynamic table and including the shipping and total cost in that same table, it is going to loop for each product that is in a customers order. 

I would suggest including the shipping and total cost variables in a separate static text block so that it doesn’t repeat for each item! 

 

 

View original
Did this topic or the replies in the thread help you find an answer to your question?

3 replies

Forum|alt.badge.img

This is the code I´m using where its looping shipping and total cost:

{{ item.Name|default:'' }}
Quantity: {{ item.Quantity|floatformat:0}}
{{ item.Price|floatformat:0 }} {{ event|lookup:'$currency_code'|default:'' }}

{{ event.ShippingMethods }} {{ event.extra.TotalShipping|floatformat:0 }} {{ event|lookup:'$currency_code'|default:'' }}

Total: {{ event|lookup:'$value'|floatformat:2 }}  {{ event|lookup:'$currency_code'|default:'' }}

 

Also tried this but it doesnt show product name and are still showing shipping and total cost for every product:

{% for item in event.extra.items %} 
{{ item.Name|default:'' }}
Quantity: {{ item.Quantity|floatformat:0 }}
{{ item.Price|floatformat:0 }} {{ event|lookup:'$currency_code'|default:'' }}
{% endfor %}

{{ event.ShippingMethods }} {{ event.extra.TotalShipping|floatformat:0 }} {{ event|lookup:'$currency_code'|default:'' }}

Total: {{ event|lookup:'$value'|floatformat:2 }}  {{ event|lookup:'$currency_code'|default:'' }}


emma.owens
Community Manager
Forum|alt.badge.img+9
  • Community Manager
  • 42 replies
  • Answer
  • February 5, 2025

Hi ​@Andreas Furuskog ! 

Thank you for reaching out to the Community! Were you able to resolve this? 

If you are using a dynamic table and including the shipping and total cost in that same table, it is going to loop for each product that is in a customers order. 

I would suggest including the shipping and total cost variables in a separate static text block so that it doesn’t repeat for each item! 

 

 


Forum|alt.badge.img
emma.owens wrote:

Hi ​@Andreas Furuskog ! 

Thank you for reaching out to the Community! Were you able to resolve this? 

If you are using a dynamic table and including the shipping and total cost in that same table, it is going to loop for each product that is in a customers order. 

I would suggest including the shipping and total cost variables in a separate static text block so that it doesn’t repeat for each item! 

 

 

Thank you so much, that was the solution.

Now it looks perfect!