I need a better way to do this.
Currently, I have added code directly to the get_price_string function within class-wc-subscriptions-product.php file, so when a free
OK old question but I needed to do this recently. I didn't want to rely on string replacement so this is how I did it (can be adapted to suit your needs - they key is to look at the attributes in $product
which are available to you):
add_filter( 'woocommerce_subscriptions_product_price_string', 'my_subs_price_string', 10, 3 );
function my_subs_price_string( $subscription_string, $product, $include ) {
/****
var_dump($product); Various variables are available to us
****/
return 'An initial easy payment of ' . wc_price( $product->subscription_sign_up_fee ) .
', a ' . $product->subscription_trial_length . ' ' . $product->subscription_trial_period .
' trial of the product, then an outright purchase of ' . wc_price( $product->subscription_price );
}