I am working on a project that uses WooCommerce and the All Products for WooCommerce Subscription plugin allowing our users to sign up for a subscription and get a discount. We would like to set up a minimum time period that the customers will have to sign up for a subscription. I did some research on doing this and it looks like the official WooCommerce plugin simply hides the “cancel” button on the user’s subscription dashboard until they’ve reached the designated time limit. Of course they charge you for this functionality and it seems like it should be very simple to just hide the cancel button until their subscription has been active for a specified amount of time but I can’t find a list of the hooks having to do with WooCommerce Subscriptions. How would I check the subscription’s original activation date and then hide the cancel button based on this.
I did try this to test hiding the cancel button but the cancel button still shows up:
add_filter('woocommerce_subscriptions_admin_order_item_actions', 'hide_cancel_button_if_less_than_3_weeks_active', 10, 2);
function hide_cancel_button($actions, $subscription) {
unset($actions['cancel']);
return $actions;
}