Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i get order_total without taxes and shipping cost ? On woocommerce

i want put an pixel for tracking my orders for affiliate.

I must get my total order after discount, so without Tax and Shipping cost.

I've make something like this but it's display 0 .

<?php echo $woocommerce->cart->get_total_ex_tax(); ?>

It's maybe because it's display currency symbol.

like image 585
Clément Houde Avatar asked Nov 20 '15 14:11

Clément Houde


People also ask

How to exclude tax in WooCommerce?

To exclude tax from shipping cost calculation, you need to go to your WooCommerce settings and slide up to the Tax section. Once there, you can uncheck the Tax option on under the Shipping column from the respective tax rule.

How do I set up shipping and taxes in WooCommerce?

Go to the WordPress.org repo to download the WooCommerce Shipping & Tax plugin, go to Plugins > Add New > Upload Plugin > Choose File > select the file you downloaded, and then Install Now. Go to Plugins > Add New and search for WooCommerce Shipping & Tax, select Install Now and Activate.


1 Answers

This it the cart total without tax and shipping.

$cart_value = number_format( (float) $order->get_total() - $order->get_total_tax() - $order->get_total_shipping() - $order->get_shipping_tax(), wc_get_price_decimals(), '.', '' );
like image 150
Vmadmax Avatar answered Oct 12 '22 16:10

Vmadmax