Skip to main content
Solved

WooCommerce Order confirmation - how to not loop everything?

  • February 4, 2025
  • 3 replies
  • 50 views

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! 

 

 

3 replies

Forum|alt.badge.img
  • Author
  • Contributor I
  • 2 replies
  • February 4, 2025

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+20
  • Community Manager
  • 216 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
  • Author
  • Contributor I
  • 2 replies
  • February 6, 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! 

 

 

Thank you so much, that was the solution.

Now it looks perfect!