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.
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.
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.
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(), '.', '' );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With