skip to Main Content

I want to delete the checkout button from the cart widget so that a user has to view their cart first and can only checkout from the cart page.

enter image description here

I am sure I have to delete some code somewhere but not sure where.

4

Answers


  1. You can do it by using the css or need to check your code to find and remove the button. If you are using the plugin then please check for the hook you are using and edit that one.

    With the CSS, you can easily hide the checkout button.

    Use it like

    .widget_sidebar .checkout_button {
        display: none;
    }
    
    Login or Signup to reply.
  2. There are two ways you can achieve this.

    The first method is to remove the button using the Woocommerce Hook. Add the below code in your functions.php file

      function my_woocommerce_widget_shopping_cart_proceed_to_checkout() 
        {
            return;
        }
        add_action( 'woocommerce_widget_shopping_cart_buttons', 
    
    'my_woocommerce_widget_shopping_cart_proceed_to_checkout', 20 );
    

    Another method is by using the CSS to hide that particular button.

    Add display: none to that specific button by identifying its class.

    .woocommerce-mini-cart__buttons .checkout.wc-forward {display: none !important;}
    
    Login or Signup to reply.
  3. If you are using a mini cart you can try this

     add_action( 'woocommerce_widget_shopping_cart_buttons', 
     'woocommerce_widget_shopping_cart_proceed_to_checkout', 20 );
    

    If you are using some plugin then let me know.

    Login or Signup to reply.
  4. You can hide the checkout button multiple ways
    1) With Hook

    function widget_checkoutbutton() 
    {
        return;
    }
    add_action( 'woocommerce_widget_shopping_cart_buttons','widget_checkoutbutton', 20 );
    

    2) With CSS
    Identify the class name of checkout button and write display none with root class.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search