The cart in header shows the sub-totals twice

This is a known issue with many themes, and it is the way that the cart sub-total information is programmed in to the theme you use.

In the Tax Toggle settings you can try the experimental Theme Override feature to see if this resolves your issue.

If not, you can try either editing your theme/creating a child theme or using JavaScript to edit the cart sub-total.

To edit your theme, the file you are probably looking for is the header.php. Inside it, look for the following style of code:

<?php echo wp_kses_post( WC()->cart->get_cart_subtotal() ); ?>

A quick solution could be that you need to remove the wp_kses_post() function which strips the HTML code that the plugin applies. This should solve it. 

If not, replace the above line or wherever your theme inserts the cart sub-totals with

<?php wc_cart_totals_subtotal_html(); ?>

For a JavaScript solution, you would need to do something like this:

// this should be the div or tag around the doubled content
const shoppingCart = $( '.cart-total' );

// this stops is running on pages where the cart is not present
if ( shoppingCart == undefined || shoppingCart.length === 0 ) {

// this splits the values of the cart
let shoppingCartValue = shoppingCart.html().split( " " ).filter( String );

// this gets if the tax should be included or not
let showTaxVar;
showTaxVar = Cookies.get( 'woocommerce_show_tax' );
showTaxVar === 'true' ? showTaxVar = true : showTaxVar = false;

if ( showTaxVar === true ) {
shoppingCart.html( shoppingCartValue[0] );
} else {
shoppingCart.html( shoppingCartValue[1] );








Article Details

Article ID:
Rating :