Minimum Periods for WooCommerce Subscriptions

Overview of Minimum Periods ↑ Back to top

Minimum Periods for WooCommerce Subscriptions is an extension for WooCommerce that allows shop owners & administrators to restrict the display of the “Cancel” button for active subscriptions on the customer’s account page. Shop owners & administrators can provide access to that button by configuring the number of minimum payments/renewals that should be made before the “Cancel” button is available.

Installation ↑ Back to top

Once you’ve purchased Minimum Periods for WooCommerce Subscriptions, you can download the plugin from your confirmation email or WooCommerce account. To install it, follow these steps:

  1. Go to Plugins > Add New > Upload
  2. Select the ZIP file you just downloaded
  3. Click Install Now, and then Activate

Once you’ve installed and activated the plugin, navigate to WooCommerce > Settings > SubScriptions > Cancelling to configure the plugin.

More information at: Installing and Managing Plugins.

Setup and Configuration ↑ Back to top

Storewide Settings ↑ Back to top

Minimum periods settings on a storewide basis.

To configure minimum periods for all subscriptions products, navigate to WooCommerce > Settings > SubScriptions > Cancelling:

  1. Select Enable Cancelling to allow customers to cancel their active subscriptions
  2. Enter the number of Minimum Period(s) (also known as payments) that a customer needs to have completed before the cancellation button is visible in the account page on the front-end.

Setting the number of Minimum Period(s) to 0 will result in customers being able to cancel their subscriptions immediately.

Per Subscription Settings ↑ Back to top

Minimum period settings on a per-subscription product basis.

To configure minimum periods on a per-product basis, navigate to Products > All Products > Your Subscription Product > Product Data > General > Cancelling:

  1. Select Override storewide settings to overide the default store settings outlined in the previous section
  2. Enter the number of Minimum Period(s) (also known as payments) that a customer needs to have completed for this subscription product before the cancellation button is visible in the account page on the front-end.

Per Variable Subscription Settings ↑ Back to top

Since version 1.1, minimum periods can also be configured on a per variable subscription basis. To configure minimum periods per variation, navigate to Products > All Products > Your Subscription Product > Product Data > Variations > Your Variation Cancelling:

  1. Select Override storewide settings to overide the default store settings outlined in the previous section
  2. Enter the number of Minimum Period(s) that a customer needs to have completed for this variation before the cancellation button is visible in the account page on the front-end.

Usage ↑ Back to top

On the customer’s account page under My-Account > Subscriptions, the customer will see the “Cancel” button if any of the following conditions are met:

  1. The Allow Cancelling checkbox is selected under WooCommerce > Settings > SubScriptions > Cancelling
  2. The Minimum Period(s) have been reached as configured in either the storewide settings or on the per-product settings

Showing the cancel button when minimum periods have been reached.

In instances where the Allow Cancelling checkbox is not selected or the Minimum Periods have not been reached, customers will only see the details of the subscription without having an option to cancel.

Hiding the cancel button when minimum periods have not been reached.

Frequently Asked Questions ↑ Back to top

Will the cancel button be hidden immediately upon activation of the extension?

Yes – As soon as the extension is activated, the “Cancel” button will be hidden on the customer’s account page on the front-end.

How are minimum periods calculated?

Minimum periods are based on the number of completed payments/renewals that have been made. This includes the initial order of the subscription product. As an example: If a subscription can only be cancelled after the first renewal, the minimum period to set is 2. This includes the original order and the first renewal.

Can I configure minimum periods for variable subscriptions?

Yes – Since version 1.1, minimum periods can be configured for both simple subscriptions and variable subscriptions.

Is it legal to hide a subscription cancellation button?

This varies between countries. Before disabling the “Cancel” button, we recommend discussing potential implications with a legal professional.

Will minimum periods apply to current subscriptions or only to new subscriptions?

It will apply to all current and future active subscriptions. Deactivating the extension also means that the cancellation button will be visible for all subscriptions.

Is it possible to show the minium terms/periods for the subscription on the my-account page?

While there are no default options for that at the moment, you could add that by following these steps:

  1. Log in to your WordPress admin area
  2. Install and activate the excellent Code Snippets plugin
  3. Select Add new
  4. Give the code snippet a title (e.g. “Minimum Periods Account Table Entry”)
  5. Ensure the “Only run on site front-end” checkbox is selected
  6. Copy/Paste the following code in the area provided:
<?php
function mpws_show_minimum_term( $subscription ) {
$mpws_get_global_cancel = get_option( 'mpws_allow_cancelling', 'yes' );
$mpws_get_global_min_periods = get_option( 'mpws_allow_cancelling_periods', '0' );
if ( 'yes' === $mpws_get_global_cancel ) {
foreach ( $subscription->get_items() as $item ) {
// Get local settings for Minimum Periods on a per-subscription basis.
$mpws_get_local_cancel = $item->get_product()->get_meta( 'mpws_allow_cancelling' );
$mpws_get_local_min_periods = $item->get_product()->get_meta( 'mpws_allow_cancelling_periods' );
if ( 'override-storewide' === $mpws_get_local_cancel ) {
if ( '0' !== $mpws_get_local_min_periods ) {
?>
<tr>
<td><?php esc_html_e( 'Minimum Term(s)', 'minimum-periods-for-woocommerce-subscriptions' ); ?></td>
<td>
<?php echo esc_html( $mpws_get_local_min_periods ); ?>
</td>
</tr>
<?php
}
}
}
} else {
?>
<tr>
<td><?php esc_html_e( 'Minimum Term(s)', 'minimum-periods-for-woocommerce-subscriptions' ); ?></td>
<td>
<?php echo esc_html( $mpws_get_global_min_periods ); ?>
</td>
</tr>
<?php
}
}
add_action( 'woocommerce_subscription_before_actions', 'mpws_show_minimum_term', 99, 1 );

When configured correctly, the subscription overview on the front-end under the my-account page will appear as follows:

WooCommerce - the most customizable eCommerce platform for building your online business.

Back to the top