Skip to content
Advertisement

Hiding element (row) in woocommerce account page

I want to hide one row in the table on account page in woocommerce. This item is called ‘end’ or ‘end date’ in the table class = shop_table subscription_details.

https://github.com/wp-premium/woocommerce-subscriptions/blob/master/templates/myaccount/subscription-details.php

How can I do it will a CSS snippet?

Advertisement

Answer

You should not use CSS to hide this but rather replace the template in your child theme. Woocommerce uses a template system that allows to cleanly modify the templates of its plugins or itself.

In your child theme create the folders “woocommerce/myaccount” and copy subscription-details.php from the plugin.

You will then have the following path:

/themes/yourtheme/woocommerce/myaccount/subscription-details.php

Source: https://docs.woocommerce.com/document/template-structure/

Then edit this file and remove this line:

    'end'                     => _x( 'End date', 'customer subscription table header', 'woocommerce-subscriptions' ),

So you will have:

$dates_to_display = apply_filters( 'wcs_subscription_details_table_dates_to_display', array(
    'start_date'              => _x( 'Start date', 'customer subscription table header', 'woocommerce-subscriptions' ),
    'last_order_date_created' => _x( 'Last order date', 'customer subscription table header', 'woocommerce-subscriptions' ),
    'next_payment'            => _x( 'Next payment date', 'customer subscription table header', 'woocommerce-subscriptions' ),
    'trial_end'               => _x( 'Trial end date', 'customer subscription table header', 'woocommerce-subscriptions' ),
), $subscription );

It should do the trick

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement