Skip to content
Advertisement

WooCommerce – get customer lifetime order cost adjusting for discounts AND refunds

I’m attempting to spit out the lifetime cost of a customers total (completed) orders. The value I’m getting back is equal to the amount if they were not discounted, however I’ve discounted all the orders to $0, thus it’s quite misleading for me to use the data if they haven’t paid any money at all. How can I get the value they actually paid, after refunds and discounts applied to that order?

JavaScript

Advertisement

Answer

This was my final function:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement