Skip to content

Hide actions from MY Subscriptions page

In this code snippet, we are using the WordPress filter “wcs_view_subscription_actions” to modify the actions that are displayed on the “My Subscriptions” page in the WooCommerce Subscriptions plugin. The filter takes two parameters: the actions array and the subscription object.

We are using a foreach loop to iterate through the actions array and within that we are using a switch statement to check the action_key. Here, we are using the unset function to remove the particular button from the “My Subscriptions” page. This means that users will no longer have the option to switch their subscription from this page.

Summary: By adding this code snippet to your functions.php file, you can hide options from my subscription page. This code can be useful for a store owner who wants to remove this option for their customers for any reason such as, for example, to prevent confusion or to simplify the user experience. Keep in mind that this code snippet will only work if you have the WooCommerce Subscriptions plugin installed and activated on your site.

Leave a Reply

Your email address will not be published. Required fields are marked *