The first part of the question (Hide the “free trial” text from Woocommerce Subscriptions price) was answered in this awesome post:
Hide the "free trial" text from Woocommerce Subscriptions price
However, it removed the "and a xx sign-up fee". Is there any way to keep the sign up fee text after removing the free trial text?
Updated - Try the following:
add_filter( 'woocommerce_subscriptions_product_price_string', 'subscriptions_custom_price_string', 20, 3 );
function subscriptions_custom_price_string( $price_string, $product, $args ) {
// Get the trial length to check if it's enabled
$trial_length = $product->get_meta('_subscription_trial_length');
$subscr_period = $product->get_meta('_subscription_period');
$subscr_fee = wc_price( $product->get_meta('_subscription_sign_up_fee') );
$sign_up_fee = isset($args['sign_up_fee']) ? __(" and a $subscr_fee sign-up fee", "woocommerce") : '';
if( $trial_length > 0 )
$price_string = $args['price'] . ' / ' . $subscr_period . $sign_up_fee;
return $price_string;
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.