Can WooCommerce Restrict Content to Subscribers?

A content block checking a visitor's active subscription status before rendering

How It Works

WooCommerce Subscriptions ships a helper function, wcs_user_has_subscription(), that checks whether a given user has an active (or specified-status) subscription to a specific product — exactly the building block needed for a lightweight content gate, without pulling in Memberships' full feature set (content drip schedules, member directories, and so on) if none of that is actually needed.

if ( wcs_user_has_subscription( get_current_user_id(), $product_id, 'active' ) ) {
    // Show the restricted content.
} else {
    // Show an upgrade prompt or excerpt instead.
}

When This Approach Fits, and When It Doesn't

  • Fits well: a single page or a handful of specific content pieces gated behind an active subscription, with no need for drip-fed content schedules or granular per-piece permissions.
  • Doesn't fit well: a large content library needing organized access levels, scheduled content releases, or a member-facing directory — that's exactly what Memberships is built for, and reimplementing it with custom checks becomes more work than just using the purpose-built plugin.
  • Easy to get wrong: caching. A page gated with a PHP check like this needs to be excluded from full-page caching (or the check needs to happen in a way compatible with the cache), or a cached "restricted" version could be served to an actual subscriber, and vice versa.
  • Easy to overlook: multiple qualifying products. If several different subscription products should all grant the same access, the check needs to account for all of them, not just one specific product ID.

Implementing It Properly

  1. Use wcs_user_has_subscription() at the specific point content is rendered, checking against the correct product ID(s) and an appropriate status (usually "active," though "active" and "pending-cancellation" together might be more appropriate if access should continue through the paid period).
  2. Account for caching explicitly — either exclude gated pages from full-page cache, or use an approach (like an AJAX-loaded restricted section) that works correctly alongside caching.
  3. For anything beyond a simple single-product gate, weigh the growing complexity against just using WooCommerce Memberships, which already solves the harder version of this problem.

See custom WooCommerce development for content-gating logic built correctly around your specific caching setup and access rules.

Available for new projects

NEXT STEP

Rather have it fixed than keep reading?

Based in Bangladesh — serving clients worldwide. Tell me what's happening and you'll have a reply within one working day.

  • Reply within one working day
  • Fixed quote before work starts
  • UK, EU and US hours covered