• Hi,

    I wanted to hide the add to cart buttons in Woocommerce so I created a custom plugin and added the following code to it:

    function remove_loop_button(){
    if(is_user_logged_in()){}else
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    }
    add_action('init','remove_loop_button');

    It worked, but I changed my mind so I deleted the code from the plugin file and yet the buttons are still gone.

    Since then I have deleted the custom plugin, deleted and reinstalled woo commerce plugin, deleted and reinstalled my theme and restarted my server.

    Nothing has worked.

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter lacheney

    (@lacheney)

    Edit: the code was:

    function remove_loop_button(){
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    }
    add_action('init','remove_loop_button');

    Delete the plugins again, update your database and then download a copy of it to your machine and look for saved data of the plugins in your database and remove them all. Once it is done, you can replace your current database with the edited version.

    NOTE: Better try it on your local WordPress installation on your computer rather than working directly on your live site.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Function still having effect after being deleted’ is closed to new replies.