Created
April 22, 2022 08:20
-
-
Save bradleysa/f41cf8c6e8dc7534d276b84f28b1564f to your computer and use it in GitHub Desktop.
WC: Slashed Cart Subtotal if Coupon Applied
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_cart_subtotal', 'bbloomer_slash_cart_subtotal_if_discount', 99, 3 ); | |
function bbloomer_slash_cart_subtotal_if_discount( $cart_subtotal, $compound, $obj ){ | |
global $woocommerce; | |
if ( $woocommerce->cart->get_cart_discount_total() <> 0 ) { | |
$new_cart_subtotal = wc_price( WC()->cart->subtotal - $woocommerce->cart->get_cart_discount_tax_total() - $woocommerce->cart->get_cart_discount_total() ); | |
$cart_subtotal = sprintf( '<del>%s</del> <b>%s</b>', $cart_subtotal , $new_cart_subtotal ); | |
} | |
return $cart_subtotal; | |
} | |
/** https://www.businessbloomer.com/woocommerce-slashed-cart-subtotal-coupon-cart/ **/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment