Luther Mwangi
Luther Mwangi

Reputation: 3

WordPress delete checkout button from cart widget

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.

Upvotes: 0

Views: 2033

Answers (5)

Rahul
Rahul

Reputation: 1

a.wc-block-components-button.wp-element-button.wp-block-woocommerce-mini-cart-checkout-button-block.wc-block-mini-cart__footer-checkout.contained {
    display: none;
}

use above CSS

Upvotes: 0

saikumar
saikumar

Reputation: 1

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.

Upvotes: 0

sleepingpanda
sleepingpanda

Reputation: 56

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.

Upvotes: 0

Rajeev
Rajeev

Reputation: 1488

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;}

Upvotes: 0

user10678889
user10678889

Reputation:

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;
}

Upvotes: 1

Related Questions