8

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!

3
  • These are not woocommerce but generic terms used for a shopping cart. the sub total refers to total price of all products in the cart and the cart total is the amount after taxes and shipping. It depends on how a theme will display these details Commented Nov 25, 2015 at 15:17
  • Thanks for responding, but I'm afraid this is not how it works in WooCommerce. In my test store, with taxes enabled, I get "subtotal":127,"subtotal_ex_tax":105.8333, so clearly subtotal includes taxes. These kind of subtleties are exactly what I'm interested in - does one but not the other include tax, shipping, discounts, etc. Commented Nov 25, 2015 at 15:54
  • docs.woothemes.com/wc-apidocs this might help. As I said, it depends on how the theme is serving subtotals. A total for a product with multiple quantities can also be a subtotal. Commented Nov 25, 2015 at 15:58

1 Answer 1

24

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)

Not the answer you're looking for? Browse other questions tagged or ask your own question.