I changed checkout price to 600€ with code below:
add_filter( 'woocommerce_order_amount_total', 'custom_cart_total' );
function custom_cart_total($order_total) {
return $order_total = 600;
}
add_action( 'woocommerce_review_order_before_order_total', 'mod_cart_total' );
function mod_cart_total() {
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
WC()->cart->total = 600;
}
Now, I need to exclude tax from this price. My idea was deduct variable in which the tax value is stored from total price , but I cannot find how to get total tax amount.
CodePudding user response:
You can use either:
WC()->cart->get_tax_totals( ); //gives total taxes
WC()->cart->get_taxes( ); //gives an array of all taxes
As described here: https://woocommerce.github.io/code-reference/classes/WC-Abstract-Order.html#method_get_taxes and here: https://woocommerce.github.io/code-reference/classes/WC-Cart.html#method_get_taxes_total