Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

$order->get_total_discount() not working?

$
0
0

Replies: 0

Hello!

I am trying to show or hide things in the order emails based on the discount given. When using $order->get_total_discount(), it frequently returns 0 but sometimes returns the correct value.

What I have been able to see is that it frequently returns a blank value when the order consists of only a variable product that is on sale.

If I go into this order in the WooCommerce dashboard, I also see that there is no discount field here. WooCommerce shows the product as you would show a non-discounted one, but with a discounted price.

I don’t quite understand what is the correct usage of $order->get_total_discount() and how I can show the discount in the order emails?

$order->get_discount_to_display() also displays 0 when $order->get_total_discount() doesn’t get a correct value.


Viewing all articles
Browse latest Browse all 59525

Trending Articles