You’re going to need to be a LOT more specific if you want to receive help on such a general question.
Provide code samples. What are you expecting it to do? What makes you believe it’s “not working”?
@madtownlems
I want to delete ad-to-cart button from single product page. I have tried by below examples but not working for me.
function change_order() {
remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart', 30 );
}
add_action( 'init', 'change_order' );
function change_order() {
remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart', 30 );
}
add_action( 'after_setup_theme', 'change_order' );
function change_order() {
remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart', 30 );
}
add_action( 'plugins_loaded', 'change_order' );
It’s possible you’re removing before the action hook was added by WooCommerce. To verify, you’d need to locate where the add_action() call was made and what the surrounding context is.
You’ve verified the callback was added with $priority 30? The removal priority must match that of the add.
You might try hooking the exact same action with a smaller $priority arg. If your callback removes the other callback at that point, it should prevent the other callback from executing.
To remove small elements from a page, it’s often easier to simply hide it with CSS instead of attempting to do a proper fix via PHP.