Solved

Woocommerce - add order data to 'placed order'


Userlevel 1
Badge +3

Hi all

 

For some reason Woocommerce and Klaviyo do not have the checkout ‘subtotal’ figure coming over.

Is there a way I can add this? 

The subtotal is the total basket excluding delivery and tax.

icon

Best answer by Dov 17 May 2021, 15:09

View original

10 replies

Userlevel 1
Badge +3

Thanks. I am hoping this becomes a core part of the Ordered Product event data. It seems like a very big oversight on Klaviyo’s part since you’d never receive an order confirmation email in the UK without a subtotal (before VAT). 

Userlevel 1
Badge +2

Hi,

4 months ago I provided a workaround to getting the SUBTOTAL. The updated code below changes floatformat:2 to floatformat:”2g” which adds formatting with thousand separators that was missing before.

${% with val1=event.extra.TotalShipping|multiply:-1 val2=event.extra.TotalTax|multiply:-1 val3=event.extra.TotalDiscount %}{{ event|lookup:'$value'|floatadd:val1|floatadd:val2|floatadd:val3|floatformat:"2g" }}{% endwith %}
Userlevel 1
Badge +2

Hi,

Until the klaviyo product team gets this implemented I have developed a workaround that works for me as an interim solution. (It doesn't allow me to format the subtotal with thousand separators like I prefer.)

The calculation we use to determine the SUBTOTAL:

SUBTOTAL = Total - TotalShipping - TotalTax - Discount
 

${% with val1=event.extra.TotalShipping|multiply:-1 val2=event.extra.TotalTax|multiply:-1 val3=event.extra.TotalDiscount %}{{ event|lookup:'$value'|floatadd:val1|floatadd:val2|floatadd:val3|floatformat:2 }}{% endwith %}

I hope this helps for the moment.

 

Userlevel 2
Badge +6

Thanks for this @Wolfgang, this is brilliant!

Userlevel 2
Badge +6

I have the same issue. I am using WordPress and woo-commerce and have installed the official Klavio pug in. I understand that the standard set up does not import the subtotal for the order when we have multiple products. I see from the above post that you are referring to an api. How to I achieve this please.

Userlevel 7
Badge +61

Hello @SDBradfo,

Thank you for sharing your question with the Klaviyo Community.

You are absolutely correct, a subtotal tag is not included in the WooCommerce event data, only the total as a whole, which includes tax and uses the following tag: {{ event| lookup ‘$value’ }}.This is the tag to use for now because there is no way to modify existing events i.e. Placed Order or the event’s data i.e. subtotal, in Klaviyo. With that said, I will submit a feature request to see if we can include subtotal in the WooCommerce event data in the future. 

As an alternative solution, you can send us a custom event using the Track API including the subtotal amount in the event. If you decide to pursue this solution, I recommend using our API reference guide. If you’d like assistance with this solution, I recommend looking into finding a Klaviyo partner, you can find more details on this process and the benefits of pursuing a Klaviyo partner in the post below:

 Thanks and have a great day.

Userlevel 1
Badge +2

Please add me to the people that think this should be standard for klaviyo WooCommerce integration.

Userlevel 7
Badge +60

Hey @Wolfgang,

Really appreciate you sharing your solutions! 

I’m sure your codes will help a lot of other Community members wondering the same thing!

Thanks for being a part of our Klaviyo Community!

David

Userlevel 7
Badge +60

Hey @Wolfgang 

I will definitely roll this up to our product team on your behalf! Thank you for sharing the feedback, we truly appreciate it!

Badge +2

@Wolfgang I appreciate it a lot! This is def. amazing!

Reply