Best way to remove 'Product Description' heading? #250

Closed
DanielBakovic opened this Issue Nov 22, 2011 · 3 comments

Comments

Projects
None yet
4 participants

I tried to remove the 'Product Description' heading from the single product page using a filter on 'woocommerce_product_description_heading' but the problem is that the filter will only remove the heading but not the h2 tags.

echo '<h2>' . apply_filters('woocommerce_product_description_heading', __('Product Description', 'woothemes')) . '</h2>';

Would it be possible to add the h2 tags to the filter, too?

I've also tried to remove the action:

remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel')

and replaced it with my own action, but then the content was displayed twice.

Therefor I decided to override the woocommerce_product_description_panel function with. It works but I don't like that solution. :)

thank you Mike

If you want to remove the heading title since it’s sort of redundant; there’s already a tab on top with a title, use this code:

add_filter('woocommerce_product_description_heading',
'sam_product_description_heading');

function sam_product_description_heading() {
    return '';
}

sun commented Mar 20, 2017

You do not need to create a custom function.

WordPress Core has several helper functions built-in. One of them is __return_null(), so the following is sufficient:

add_filter('woocommerce_product_description_heading', '__return_null');

If you want to be on the same side and strictly use the same data type, even better, use __return_empty_string():

add_filter('woocommerce_product_description_heading', '__return_empty_string');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment