How to hide the text “free trial” in WooCommerce Subscriptions

We all love subscription based commerce websites. They produce recurring revenue, the main stream to on-going revenue, however not all subscription companies offer the same programs to their clients.  Thus some simple modifications need to be made to the subscription pricing statement.

How to hide the text “free trial”?

Example: a service based company might offer hosting solutions.  And with their hosting offering there could be a trial period before charges start.  In that scenario it makes sense to have a ‘free trial period’.

However if you sell an inventory subscription solution, like a weekly “Meal Plan” where your meals are delivered to your front door (Hello Fresh, Blue Apron or Home Chef) then it does not make sense to have a “free trial period” language displayed on the shopping cart.

To hide the text ‘free trial’ in the WooCommerce Subscription price string we suggest using the filter hook 'woocommerce_subscriptions_product_price_string' see here:

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 = get_post_meta( $product->get_id(), '_subscription_trial_length', true );
if( $trial_length > 0 )
$price_string = $args['price'];

return $price_string;
}

Code goes in function.php file of your active child theme (or theme).  reference from StackOverFlow