Skip to content

Instantly share code, notes, and snippets.

@WillBrubaker
Created October 29, 2014 19:45
Show Gist options
  • Save WillBrubaker/12a0d3b13b862ec6f3fd to your computer and use it in GitHub Desktop.
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
<?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