- This topic has 11 replies, 2 voices, and was last updated 3 years, 6 months ago by
David.
-
AuthorPosts
-
May 5, 2020 at 2:20 am #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.
May 5, 2020 at 3:24 am #1270185David
StaffCustomer SupportHi there,
you can add this PHP snippet to your site:
remove_action( 'woocommerce_proceed_to_checkout','woocommerce_button_proceed_to_checkout', 20);May 5, 2020 at 2:03 pm #1271178Michael
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.
May 5, 2020 at 3:29 pm #1271241Leo
StaffCustomer SupportThe code can be added using one of these methods:
https://docs.generatepress.com/article/adding-php/May 5, 2020 at 3:42 pm #1271250Michael
Legend!
May 7, 2020 at 4:08 am #1273420David
StaffCustomer SupportGlad we could be of help
October 28, 2022 at 2:14 am #2391094Luca
Instead of removing the checkout button completely, is it possible to stop its function and put the overlay?
October 28, 2022 at 4:33 am #2391278David
StaffCustomer SupportSo its no longer a button its just a label or something ?
October 28, 2022 at 5:17 am #2391325Luca
Exactly
October 28, 2022 at 6:32 am #2391426David
StaffCustomer SupportOk, 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 hookand in the field provided add:woocommerce_proceed_to_checkout
In the priority field add20
Set the Display Rules to theEntire SiteThen add whatever you require in the block editor.
October 28, 2022 at 7:08 am #2391492Luca
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…
October 28, 2022 at 8:19 am #2391823David
StaffCustomer SupportCan you try the element method to hook in your alternative content ?
-
AuthorPosts
- You must be logged in to reply to this topic.