Disable WooCommerce action

by Anagio   Last Updated October 11, 2018 15:08 PM - source

I'm customizing a WooCommerce theme and am going to be moving the title. There is an action in content-single-product.php called:

do_action( 'woocommerce_single_product_summary' );

in the woocommerce_hooks.php file the title action is:

add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );

I can easily comment this out and place the title function where I need to. I'd prefer to disable the title using a function in my themes functions.php file so I don't have to worry about modifying core files. What would the function be to disable this title action?

Answers 2

That would be:

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );

You can read about it here: remove_action Codex

January 01, 2013 14:44 PM

Sometimes I got problems removing an action just using remove_action (it is also stated within the documentation to use it not directly).

So I just remove it within the action itself, but with a very low priority.

add_action('woocommerce_single_product_summary', function () {
    remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);
}, -1000);
October 11, 2018 14:47 PM

Related Questions

All plugins randomly deactivating

Updated April 18, 2017 17:08 PM