Search code examples
phptemplateswoocommercehook-woocommercewoocommerce-subscriptions

Change the table dates from My Account View Subscription in WooCommerce


With WooCommerce Subscription plugin specifically, I am encountering difficulty editing the appearance of the "my-account/view-subscription" page. I need to remove the line displaying the "Next Payment Date." Please refer to the attached screenshot for clarity.

enter image description here

Your guidance on how to accomplish this task would be greatly appreciated.

I received a suggestion to make CSS adjustments, but unfortunately, the provided solution did not yield the desired outcome.


Solution

  • Use the following code snippet:

    add_filter( 'wcs_subscription_details_table_dates_to_display', 'filter_subscription_details_table_dates' );
    function filter_subscription_details_table_dates( $table_dates ) {
        if ( is_wc_endpoint_url('view-subscription') && isset($table_dates['next_payment']) ) {
            unset($table_dates['next_payment']); // Remove "Next payment" row.
        }
        return $table_dates;
    }
    

    Code goes in functions.php file of your child theme (or in a plugin). Tested and work.