Reputation: 11
In woocommerce, I am using the following to remove the shipping block in cart totals section bloc:
function disable_shipping_calc_on_cart( $show_shipping ) {
if( is_cart() ) {
return false;
}
return $show_shipping;
}
add_filter( 'woocommerce_cart_ready_to_calc_shipping', 'disable_shipping_calc_on_cart', 99 );
But in that cart totals section bloc there are some other things like the cart Subtotal and Total.
I just need to keep only Total
Any help is welcome.
Upvotes: 1
Views: 5071
Reputation: 254473
You seem to keep only the total on cart totals section. For that the only way is overriding woocommerce templates.
There is 2 steps:
wp-content/plugins/woocommerce/templates/cart/cart-totals.php
to your active theme woocommerce/cart/cart-totals.php
(if it not exist yet).cart-totals.php
template and removing code:You will not need your function code anymore
Now your cart totals will be something like this:
Upvotes: 1
Reputation: 530
add_filter( 'woocommerce_get_order_item_totals', 'adjust_woocommerce_get_order_item_totals' );
function adjust_woocommerce_get_order_item_totals( $totals ) {
unset($totals['cart_subtotal'] );
return $totals;
}
Is this what you are looking for? Basically you asked to remove the subtotal.
Upvotes: 0