I have a website running woocommerce and on the cart page it’s showing 2 cart totals at the checkout. I’m not seeing where anyone has even posted about this anywhere so it seems really random. Any ideas?
My quick fix was to just hide the second one using css.
The function call in the template got removed, added back via an action. Every theme overwriting this template will still have the original function call, as well as the function added via the action. This shouldn’t be pushed in a fix release like this, in my humble opinion. But now it’s there, let’s resolve this.
Resolving the issue
Resolving this issue is actually fairly easy. Your theme will have the cart/cart.php overwritten in the woocommerce folder of your (child) theme. In there, you will find this line (or at least something similar calling that same function):
You need to remove this line from your overwritten template file and your cart totals should only appear once.
Although not the cleanest, here’s an alternative solution if you don’t have a child theme and/or you don’t want to modify your PHP files:
Find the CSS selector of your cart totals. In my case, it was
div.cart_totals.calculated_shipping.wow.fadeInLeft.animated
And use an
:nth-of-type()
pseudo-selector like so:That’ll make sure if there’s a second cart totals div then it won’t display.