Solved

Add multiple prices to a subtotal


Badge +1

Hi there,

I want to show a subtotal of all line items in my order email.
Unfortunately the WooCommerce event data doesn’t include that.

My idea is to loop through every item in the order and add the prices to a subtotal.
Is that possible?

I saw, that there are “For blocks”. Can I use them for my idea?

icon

Best answer by Omar 9 May 2022, 18:19

View original

4 replies

Userlevel 7
Badge +61

Hi @SimonK,

At this time, WooCommerce only sends us the subtotal price for a single product, but not the total subtotal price of all products combined. Subtotal across all items would need to be a data point that we can reference from the WooCommerce’s event metadata in order to make this work reliably. “For” blocks will allow you to display, say the items in the basket with their respective quantities but it won’t add everything together.

I hope that’s helpful and thanks for being a member of our community.

Badge +1

Hi @Dov,

thank you for your answer.

So there is no way to show subtotals in an order email?

Userlevel 7
Badge +44

@SimonK the answer is that it depends, it always depends.

If you have a developer on your end the easiest way is to make sure you add this data in the event or create a new event that has all the data you're looking for. 

Not sure which event data you're currently referencing but either way having the data you need to use in the emails included in the event is the best solution to solve that problem.

Some examples here: Added to cart or placed order

 

Hope it helps.

 

Regards,

Omar

Badge +1

Thank you @Omar 

I will take a look at your links. Maybe there is a way to solve this.

Is it possible to add these JS Code in addition to the WooCommerce integration?

Reply