Add below functions to your function.php file in WordPress child theme
/*Proceed to Checkout*/
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
add_action('woocommerce_proceed_to_checkout', 'sm_woo_custom_checkout_button_text',20);
function sm_woo_custom_checkout_button_text() {
$checkout_url = WC()->cart->get_checkout_url();
?>
<a href="<?php echo $checkout_url; ?>" class="checkout-button button alt wc-forward"><?php _e( 'Check On Out', 'woocommerce' ); ?></a>
<?php
}
/*Add to cart*/
add_filter( 'woocommerce_product_single_add_to_cart_text', 'sm_woo_custom_cart_button_text' );
add_filter( 'woocommerce_product_add_to_cart_text', 'sm_woo_custom_cart_button_text' );
function sm_woo_custom_cart_button_text() {
return __( 'Add to basket', 'woocommerce' );
}
/*View Cart*/
function sm_text_view_cart_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'View Cart' :
$translated_text = __( 'Check On Out', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'sm_text_view_cart_strings', 20, 3 );
Thanks, great article.
Welcome! 🙂
Excellent. Thank you very mucho!
Welcome! 🙂
Nice code! However, in my case the new button is added, the old one doesn’t disappear. What am I doing wrong?
Welcome! 🙂 Can you share your code on my email Id please?.
Thank you
Welcome! 🙂
Thank you for this code.
When i add the proceed to checkout line’s of code it works wonderfully but as soon as i update the cart (change quantity from 1 to 3 for example) the button text reverts back to “Proceed to checkout”
How can we keep a custom button text even after the cart updates.
You help is greatly appreciated!
Thanks!
Wow thanks… i’m new in woocommerce 😀
Thank you! I’ve been looking for help on this everywhere and this worked perfectly for me.
Add to Cart works well
Proceed to checkout creates one more button, so 2 buttons “Proceed to checkout” and “Checkout” are displayed.
View cart doesnt work