I am trying to remove the "with a XX day free trial" from my product, cart and checkout pages. I need to have the feature still work without having to express it in the product details.
1 Answers
1
votes
It is possible using the filter hook 'woocommerce_subscriptions_product_price_string'
for this hooked function, this way:
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).
Tested and works.