[Resolved] Remove Proceed To Checkout Bottom Woocommerce

Home Forums Support [Resolved] Remove Proceed To Checkout Bottom Woocommerce

Home Forums Support Remove Proceed To Checkout Bottom Woocommerce

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1270092
    Michael

    Hi,

    I’m using the basic Generate Press theme and and have recently added a Woocommerce shopping page to our website. We are using Paypal to directly checkout rather than proceeding to a checkout page.

    My Question is. How can I remove the “Proceed To Check Out” button on the shopping cart page. Some say, add some CSS code, others say edit the PHP Page. Not sure which would be the best way to go and what code to remove/add.

    Thanks in advance.

    #1270185
    David
    Staff
    Customer Support

    Hi there,

    you can add this PHP snippet to your site:

    remove_action( 'woocommerce_proceed_to_checkout','woocommerce_button_proceed_to_checkout', 20);

    #1271178
    Michael

    Thanks David,

    At risk of sounding like a dummy. When you say “place the code on your site”, on what page/line exactly.

    Thanks again.

    #1271241
    Leo
    Staff
    Customer Support

    The code can be added using one of these methods:
    https://docs.generatepress.com/article/adding-php/

    #1271250
    Michael

    Legend!

    #1273420
    David
    Staff
    Customer Support

    Glad we could be of help

    #2391094
    Luca

    Instead of removing the checkout button completely, is it possible to stop its function and put the overlay?

    #2391278
    David
    Staff
    Customer Support

    So its no longer a button its just a label or something ?

    #2391325
    Luca

    Exactly

    #2391426
    David
    Staff
    Customer Support

    Ok, so best thing is:

    1. remove the current button using the above snipept:

    
    remove_action( 'woocommerce_proceed_to_checkout','woocommerce_button_proceed_to_checkout', 20);
    

    2. Hook in your own label with this snippet:

    
    add_action( 'woocommerce_proceed_to_checkout', function(){
        <?php
        <div class="checkout-button">
        <?php esc_html_e( 'Proceed to checkout', 'woocommerce' ); ?>
        </div>
        ?>
    }, 20);

    Or you can instead of using code to hook in a label.
    You can use a GP Block Element – Hook:

    https://docs.generatepress.com/article/block-element-hook/

    In the sidebar set the Hook to Custom hook and in the field provided add: woocommerce_proceed_to_checkout
    In the priority field add 20
    Set the Display Rules to the Entire Site

    Then add whatever you require in the block editor.

    #2391492
    Luca

    This is my code:

    /**
    * Set a minimum order amount for checkout before add shipping rates and taxes, and remove checkout button from cart
    */

    add_action( ‘woocommerce_checkout_process’, ‘wc_minimum_order_amount’ );
    add_action( ‘woocommerce_before_cart’ , ‘wc_minimum_order_amount’ );
    add_action( ‘woocommerce_before_checkout_form’, ‘wc_minimum_order_amount’ );

    function wc_minimum_order_amount() {
    // Set this variable to specify a minimum order value
    $minimum = 30;

    //remove checkout button from cart
    if ( WC()->cart->subtotal < $minimum ) {
    remove_action( ‘woocommerce_proceed_to_checkout’,’woocommerce_button_proceed_to_checkout’, 20);
    }

    //add error messages
    if ( WC()->cart->subtotal < $minimum ) {

    if( is_cart() ) {

    wc_print_notice(
    sprintf( ‘Devi effettuare un acquisto minimo di %s per completare un ordine, attualmente il tuo ordine è di %s.’ ,
    wc_price( $minimum ),
    wc_price( WC()->cart->subtotal )
    ), ‘error’
    );

    }
    }
    }

    I try to insert your:

    add_action( ‘woocommerce_proceed_to_checkout’, function(){
    <?php

    <?php esc_html_e( ‘Proceed to checkout’, ‘woocommerce’ ); ?>

    ?>
    }, 20);

    After:

    //remove checkout button from cart
    if ( WC()->cart->subtotal < $minimum ) {
    remove_action( ‘woocommerce_proceed_to_checkout’,’woocommerce_button_proceed_to_checkout’, 20);

    But doesn’t work…

    #2391823
    David
    Staff
    Customer Support

    Can you try the element method to hook in your alternative content ?

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.