Created
October 29, 2014 19:45
-
-
Save WillBrubaker/12a0d3b13b862ec6f3fd to your computer and use it in GitHub Desktop.
For WooCommerce Subscriptions, removes some of the strings during on the checkout page
This file contains hidden or 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
<?php | |
/* | |
Don't copy the opening PHP tag | |
*/ | |
add_filter( 'woocommerce_cart_item_subtotal', 'wooninja_display_subtotal', 20, 1 ); | |
add_filter( 'woocommerce_cart_subtotal', 'wooninja_display_subtotal', 20, 1 ); | |
add_filter( 'woocommerce_cart_total', 'wooninja_display_subtotal', 20, 1 ); | |
function wooninja_display_subtotal( $subtotal ) { | |
$regex = '#(<span class="amount">.*?</span>)#'; | |
if ( preg_match( $regex, $subtotal, $match ) ) { | |
$subtotal = $match[0]; | |
} | |
return $subtotal; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment