Remove action on product archive page [closed]

First thing, regarding your comment “everytime I update the theme I’m screwed” – you should always use a child theme when doing any customisations .

Second, your remove_action call is wrong. As per the documentation you’ve linked to already, it sates that the first argument is $tag and the second is $function_to_remove. Right now, your arguments are reversed.

So the correct call would be

/* Remove product description on product archive page */
remove_action( 'woocommerce_shop_loop_item_desc', 'woocommerce_template_loop_rating', 5);
remove_action( 'woocommerce_shop_loop_item_desc', 'woocommerce_template_loop_price', 10);

Update:

if the above solution doesn’t work, it might be because the hook triggers after theme setup. In this case you can try the following :

add_action( 'after_setup_theme', 'my_remove_parent_theme_stuff', 0 );

function my_remove_parent_theme_stuff() {
    remove_action( 'woocommerce_shop_loop_item_desc', 'woocommerce_template_loop_rating', 5);
    remove_action( 'woocommerce_shop_loop_item_desc', 'woocommerce_template_loop_price', 10);

}

Leave a Comment