Set a Minimum Subscription Period in WooCommerce Subscriptions

WooCommerce Subscriptions currently doesn’t allow a minimum subscription time period when setting up a subscription, nut you can manipulate the WooCommerce Subscription  Sign-up fee and free trial fields to allow you to do so.

Let’s say you want a minimum 3 month sign up period which then defaults to monthly after the 3 months is up, the monthly fee is $50 – so the initial payment is $150 then it goes to $50 after 3 months have passed.

Woocommerce Minimum Subscription Period

So in the above you would set the regular subscription price at $50 a month, set the Sign-Up fee at $150 and put 3 months for the free trial

Woocommerce Minimum Subscription Free Period

Problem on the front end is the wording – it’s not a free trial!

There is a filter to change that text string – woocommerce_subscriptions_product_price_string, so in your functions.php add a code snippet that replaces part of the string to make more sense.

add_filter('woocommerce_subscriptions_product_price_string', 'woo_change_subscriptions_product_price_string' );
function woo_change_subscriptions_product_price_string( $subscription_string ) {

        $subscription_string = str_replace( 'with a', 'with an initial', $subscription_string );
        $subscription_string = str_replace( 'free trial and a', 'minimum subscription at', $subscription_string );
        $subscription_string = str_replace( ' sign-up fee', '', $subscription_string );     

        return $subscription_string;
}

Woocommerce Minimum Subscription Paid Period

Now the initial minimum time/money is paid and then the subscription goes to a monthly charge.

Leave all Comment