Khandaker Toihidul Islam
Front-end Developer
React Js | Javascript | HTML | CSS | Bootstrap | Wordpress | PHP | Mysql

Woocommerce cart functions

  • 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,

  • 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)

You may also like...