Skip to main content
PRO Only
Pro Feature

This page documents Pro edition compatibility with WooCommerce Subscriptions. Upgrade to Pro to access these features.

Pro: WooCommerce Subscriptions Compatibility

Complete integration with WooCommerce Subscriptions for subscription-based download limits and access control.

Overview

Free Downloads for WooCommerce Pro integrates with WooCommerce Subscriptions to provide:

  • Subscription-based download limits
  • Free trial-specific limits
  • Renewal-based limit refresh
  • Subscription status checking
  • Automatic limit adjustments

Features

Subscription-Based Limits

Set download limits based on subscription status.

Active Subscriptions:

  • Apply subscription-specific limits
  • Track downloads per subscription
  • Enforce limits per billing period

Inactive Subscriptions:

  • Revert to global limits
  • Block downloads if required
  • Show upgrade prompts

Free Trial Limits

Different limits during subscription free trial.

Configuration:

  • Lower limits during trial
  • Encourage subscription conversion
  • Prevent trial abuse
  • Track trial downloads

Behavior:

  • Trial active: Apply trial limits
  • Trial ended: Apply regular limits
  • Trial cancelled: Revert to global limits

Renewal-Based Refresh

Limits reset on subscription renewal.

Automatic Reset:

  • Daily subscriptions: Reset daily
  • Weekly subscriptions: Reset weekly
  • Monthly subscriptions: Reset monthly
  • Yearly subscriptions: Reset yearly

Manual Reset:

  • Admin can reset limits
  • Reset on status change
  • Reset on plan change

Subscription Status Checking

Automatic verification of subscription status.

Status Checks:

  • Active subscription
  • On-hold subscription
  • Cancelled subscription
  • Expired subscription
  • Pending cancellation

Actions:

  • Active: Apply subscription limits
  • On-hold: Apply reduced limits or block
  • Cancelled: Revert to global limits
  • Expired: Block downloads or revert

Configuration

Enable Subscription Integration

Step 1: Install WooCommerce Subscriptions

Purchase and install WooCommerce Subscriptions from WooCommerce.com.

Step 2: Create Subscription Products

  1. Go to Products > Add New
  2. Select "Simple subscription" or "Variable subscription"
  3. Configure subscription details
  4. Add downloadable files
  5. Set as free (£0.00)
  6. Publish product

Step 3: Configure Download Limits

  1. Go to WP Enhanced > Free Download Woo
  2. Click Download Limits tab
  3. Enable download limits
  4. Configure subscription-specific settings
  5. Save changes

Subscription Limit Settings

Per Subscription: Configure limits for each subscription product.

Settings:

  • Enable limits for this subscription
  • Download limit amount
  • Limit frequency (matches billing period)
  • Applicable products
  • Trial limits (if applicable)

Example:

Monthly Subscription:
- Regular: 20 downloads per month
- Trial: 5 downloads during 7-day trial

Trial Configuration

Enable Trial Limits: Check "Enable free trial limits"

Trial Settings:

  • Trial limit amount
  • Trial frequency
  • Trial products

Use Cases:

  • Test subscription value
  • Encourage conversions
  • Prevent abuse
  • Gather feedback

Use Cases

Subscription Tiers

Basic Subscription ($9/month):

  • 10 downloads per month
  • Access to basic products
  • Standard support

Pro Subscription ($19/month):

  • 50 downloads per month
  • Access to premium products
  • Priority support

Enterprise Subscription ($49/month):

  • Unlimited downloads
  • Access to all products
  • VIP support

Free Trial Strategy

7-Day Free Trial:

  • 3 downloads during trial
  • Access to sample products
  • Automatic conversion to paid

After Trial:

  • 20 downloads per month
  • Full product access
  • Billing starts

Renewal Management

Monthly Renewal:

  • Limits reset on 1st of month
  • Track monthly usage
  • Send usage reports

Annual Renewal:

  • Limits reset on anniversary
  • Annual usage tracking
  • Renewal reminders

Developer Integration

Check Subscription Status

// Check if user has active subscription
if (function_exists('wcs_user_has_subscription')) {
$has_subscription = wcs_user_has_subscription($user_id, '', 'active');

if ($has_subscription) {
// Apply subscription limits
}
}

Get Subscription Limits

// Get user's subscriptions
$subscriptions = wcs_get_users_subscriptions($user_id);

foreach ($subscriptions as $subscription) {
if ($subscription->has_status('active')) {
// Get subscription limits
$product_id = $subscription->get_product_id();
$limits = get_post_meta($product_id, 'somdn_subscription_limits', true);
}
}

Check Trial Status

// Check if subscription is in trial
$subscription = wcs_get_subscription($subscription_id);

if ($subscription->is_trial()) {
// Apply trial limits
$trial_limits = get_post_meta($product_id, 'somdn_trial_limits', true);
} else {
// Apply regular limits
$regular_limits = get_post_meta($product_id, 'somdn_regular_limits', true);
}

Custom Subscription Logic

add_filter('somdn_subscription_limit_check', 'custom_subscription_limits', 10, 3);
function custom_subscription_limits($limits, $user_id, $product_id) {
// Get user's active subscriptions
$subscriptions = wcs_get_users_subscriptions($user_id);

foreach ($subscriptions as $subscription) {
if ($subscription->has_status('active')) {
// Check if in trial
if ($subscription->is_trial()) {
$limits['amount'] = 5; // Trial limit
} else {
$limits['amount'] = 20; // Regular limit
}

// Match frequency to billing period
$billing_period = $subscription->get_billing_period();
$limits['freq'] = ucfirst($billing_period);
}
}

return $limits;
}

Reset Limits on Renewal

add_action('woocommerce_subscription_renewal_payment_complete', 'reset_download_limits');
function reset_download_limits($subscription) {
$user_id = $subscription->get_user_id();

// Delete download count for this period
delete_user_meta($user_id, 'somdn_download_count_' . date('Y-m'));

// Log reset
error_log("Download limits reset for user {$user_id} on subscription renewal");
}

Troubleshooting

Limits Not Resetting

Check:

  1. ✅ Subscription renewed successfully
  2. ✅ Renewal hooks firing
  3. ✅ Limit frequency matches billing period
  4. ✅ Cron jobs running

Solution: Verify subscription renewal process and cron configuration.

Trial Limits Not Applying

Check:

  1. ✅ Subscription has free trial
  2. ✅ User is in trial period
  3. ✅ Trial limits configured
  4. ✅ Trial detection working

Solution: Verify trial configuration and status detection.

Wrong Limits After Renewal

Check:

  1. ✅ Renewal completed successfully
  2. ✅ Subscription status is active
  3. ✅ Limit reset triggered
  4. ✅ Cache cleared

Solution: Clear all caches and verify renewal hooks.

Subscription Not Detected

Check:

  1. ✅ WooCommerce Subscriptions version
  2. ✅ Subscription status
  3. ✅ User has subscription
  4. ✅ Subscription product configured

Solution: Verify subscription assignment and status.

Best Practices

Limit Configuration

  • Match limits to billing period
  • Set realistic trial limits
  • Consider subscription value
  • Monitor usage patterns
  • Adjust based on feedback

Trial Strategy

  • Offer generous trial limits
  • Showcase subscription value
  • Track trial conversions
  • Optimize trial experience
  • Encourage upgrades

Renewal Management

  • Automate limit resets
  • Send renewal reminders
  • Track renewal rates
  • Monitor usage before renewal
  • Offer renewal incentives

Communication

  • Clearly state limits
  • Show remaining downloads
  • Send usage notifications
  • Provide upgrade options
  • Offer support

Integration Examples

Subscription Product Setup

// Create subscription product with download limits
$product = new WC_Product_Subscription();
$product->set_name('Monthly Download Subscription');
$product->set_regular_price(9.99);
$product->set_subscription_period('month');
$product->set_subscription_period_interval(1);
$product->set_downloadable(true);
$product->set_virtual(true);

// Add download files
$downloads = array(
array(
'name' => 'Monthly eBook',
'file' => 'path/to/file.pdf'
)
);
$product->set_downloads($downloads);

// Save product
$product->save();

// Add download limits
update_post_meta($product->get_id(), 'somdn_subscription_limits', array(
'amount' => 20,
'freq' => 'Month'
));

Usage Tracking

// Track subscription downloads
add_action('somdn_count_download', 'track_subscription_download', 10, 3);
function track_subscription_download($product_id, $user_id, $variation_id) {
// Get user's subscription
$subscriptions = wcs_get_users_subscriptions($user_id);

foreach ($subscriptions as $subscription) {
if ($subscription->has_status('active')) {
// Increment download count
$count = get_post_meta($subscription->get_id(), 'download_count', true);
update_post_meta($subscription->get_id(), 'download_count', $count + 1);
}
}
}