71 ![](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201205%20630'%3E%3C/svg%3E)
WooCommerce: show slashed original and discounted subtotal @ Cart
This is a nice snippet to let users know what the original cart amount was by slashing the cart subtotal and showing the cart subtotal after discounts on the same line (Cart totals > subtotal).
You can then hide the coupon code line if you wish!
![](../wp-content/uploads/2022/12/woocommerce-slashed-cart-subtotal-if-coupon-cart_638b748ea1615.png)
PHP Snippet: show slashed original and discounted subtotal @ WooCommerce Cart
/**
* @snippet Cart subtotal slashed if coupon applied @ WooCommerce Cart
* @how-to Get tutoraspire.com FREE
* @author Tutor Aspire
* @testedwith WooCommerce 6
* @donate $9 https://tutoraspire.com
*/
add_filter( 'woocommerce_cart_subtotal', 'tutoraspire_slash_cart_subtotal_if_discount', 9999, 3 );
function tutoraspire_slash_cart_subtotal_if_discount( $cart_subtotal, $compound, $cart ){
if ( $cart->get_cart_discount_total() > 0 ) {
return wc_format_sale_price( $cart->get_subtotal(), $cart->get_subtotal() - $cart->get_cart_discount_total() );
}
return $cart_subtotal;
}