Skip to content

Instantly share code, notes, and snippets.

@jessLundie
Last active December 17, 2020 17:46
Show Gist options
  • Save jessLundie/603d9ef96f6c0d8fc01662fdd1acd3ac to your computer and use it in GitHub Desktop.
Save jessLundie/603d9ef96f6c0d8fc01662fdd1acd3ac to your computer and use it in GitHub Desktop.
Expand access to subscription downloads in WooCommerce Subscriptions based on subscription status
<?php
function expand_access_subscription_downloads( $is_download_permitted, $subscription ) {
if ( $subscription->has_status ( 'cancelled', 'expired' ) ) {
return true;
}
return $is_download_permitted;
}
add_filter ( 'woocommerce_order_is_download_permitted', 'expand_access_subscription_downloads', 10, 2 );
@jessLundie
Copy link
Author

Note: This code is compatible with content dripping. If Drip downloadable content was enabled throughout the lifetime of the subscription, customers will only have access to files that were available to them based on the site's content dripping settings and their paid renewal orders.

@wprebel
Copy link

wprebel commented Apr 30, 2020

We are interested in using this. Do we just place the php file in the subscriptions subfolder?

@jessLundie
Copy link
Author

We are interested in using this. Do we just place the php file in the subscriptions subfolder?

@wprebel - Sorry for the delayed response! If still relevant, I recommend adding this code to your site using a plugin such as Code Snippets. You can also add it to your child theme's functions.php file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment