Reputation: 23
I would like to remove only total row on cart and checkout page not the whole block. I am not able to find any action or filter to remove the total i still want to leave the subtotal . I am using the code below but it hides the whole order block and also it does not remove it from the bill that is generated after checkout
add_action( 'woocommerce_checkout_order_review', 'remove_checkout_totals', 1 );
function remove_checkout_totals()
{remove_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );}
Upvotes: 1
Views: 4014
Reputation: 1
There is order-total
class for order total. You should add a line of code into your css. It should solve the problem.
.order-total { display: none; }
Upvotes: 0
Reputation: 3562
You will not find any hook specified for the Total row because they are hard coded in the templates the only way to remove the total row from the cart page and checkout pages by modifying those pages template and to do that you need to follow few steps as follow:
woocommerce
.woocommerce
which you just created called name checkout
and cart
.review-order.php
put it inside checkout
folder and cart-totals.php
put it inside the cart
folder then copy the content from the original files which you can find in wp-content/plugins/woocoomerce/templates/checkout/review-order.php
and wp-content/plugins/woocoomerce/templates/cart/cart-totals.php
Last step:
find the following lines in both files and delete them:
<tr class="order-total">
<th><?php _e('Total', 'woocommerce'); ?></th>
<td><?php wc_cart_totals_order_total_html(); ?></td>
</tr>
Order received page
To Remove the Total from Order received page you can use woocommerce_get_order_item_totals
hook and unset the total as follow:
add_action('woocommerce_get_order_item_totals', 'remove_total', 10, 1);
function remove_total($array)
{
unset($array['order_total']);
return $array;
}
put the code above in your functions.php
That's it.
Upvotes: 3