Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WooCommerce: what's the difference between cart total and subtotal?

Tags:

woocommerce

I can't find an explanation anywhere in the docs. I also looked at the source code, but it doesn't help, either. Many thanks!

like image 711
Jan Żankowski Avatar asked Nov 25 '15 15:11

Jan Żankowski


1 Answers

OK, I figured it out on my test store with the following settings:

  • total prices of products in cart (with taxes): 127
  • shipping costs: 12
  • fees (taxable): 13
  • discount from a coupon: 10

With these settings, I get the following on my cart object:

"cart_contents_total":97.4998, "total":144.6, "subtotal":127, "subtotal_ex_tax":105.8333, "tax_total":22.1001, "discount_cart":8.3334, "discount_cart_tax":1.6667, "fee_total":13, "shipping_total":10, "shipping_tax_total":2, "fees":[{"id":"extra-fee", "name":"Extra Fee", "amount":13, "tax_class":"", "taxable":true, "tax":2.6, "tax_data":{"1":2.6}

So, the answer is:

  • total = total prices of products in cart (with tax) + shipping cost + fees + tax on fees - discount
  • subtotal = total prices of products in cart (with tax)
like image 104
Jan Żankowski Avatar answered Oct 21 '22 06:10

Jan Żankowski