Woo-commerce | Disable proceed to checkout button in cart page if total in cart less than 15 [closed]

Try this:

function disable_checkout_button_no_shipping() { 

    $total = WC()->cart->get_cart_subtotal(); // Change made
    if( $total < 15 ){
        remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
        echo '<a href="#" class="checkout-button button alt wc-forward">Proceed to checkout</a>';
    }  
}

add_action( 'woocommerce_proceed_to_checkout', 'disable_checkout_button_no_shipping', 1 );

Leave a Comment