How to Change Proceed To Checkout Text In WooCommerce

Change Proceed to Checkout Text in WooCommerce
If you want to change Proceed to Checkout text in the WooCommerce cart page, you can do so by creating a function that changes the default text to your custom text.

In this post, I will show you how to change proceed to checkout text with a practical example and share the code that is ready for you to use.

The Proceed to Checkout text is located on the WooCommerce cart page and appears after the totals as shown in this image:How to Change Proceed To Checkout Text in WooCommerce

This button function is to redirect the cart page to the checkout page after you have verified that the contents of the cart are OK.

You probably want to change this Proceed to Checkout text to custom text like ‘Go to Secure Checkout’.

Steps to Change Proceed To Checkout Text In WooCommerce

To change this text you need to follow the following steps:

  1. Log into your WordPress site and access the dashboard as the admin user. If you have no idea how to log in to your WordPress site, there is a detailed guide here.
  2. From the dashboard menu, click on the Appearance Menu > Theme Editor Menu. When the theme editor page is opened look for the theme functions file that has the extension functions.php. Open this functions file where we will add the function that will change proceed to checkout text to something like ‘Go to Secure Checkout’.
  3. Add the following code to the functions.php and change the text ‘Go to Secure Checkout’ in the code to the custom code that you want to display on the Proceed to Cart Checkout button.
    /**
    *   Change Proceed To Checkout Text in WooCommerce
    *   Add this code in your active theme functions.php file
    **/
    function woocommerce_button_proceed_to_checkout() {
    	
           $new_checkout_url = WC()->cart->get_checkout_url();
           ?>
           <a href="<?php echo $new_checkout_url; ?>" class="checkout-button button alt wc-forward">
    	   
    	   <?php _e( 'Go to Secure Checkout', 'woocommerce' ); ?></a>
    	   
    <?php
    }
    
  4. Save the changes on the functions.php file and visit the cart page on your WooCommerce site to see if the proceed to checkout text has changed to your custom text as shown in the image below :How to Change Proceed To Checkout Text in WooCommerce

How to Code Works

This code is basically a function added to your WordPress theme that will not work when you change to another WordPress theme. You may have to add the same code snippet to the other WooCommerce theme when you switch themes.

The first step in the code is to get the WooCommerce checkout URL and saves it in a variable in this line of code  :

$new_checkout_url = WC()->cart->get_checkout_url();

The second step is to display the URL with  a href tag and we display the text in the href as our custom text in the brackets and with the WooCommerce text-domain that helps in translating WooCommerce strings :

 <a href="<?php echo $new_checkout_url; ?>" class="checkout-button button alt wc-forward">

   <?php _e( 'Go to Secure Checkout', 'woocommerce' ); ?>

</a>

As you can see in the code we are using the URL variable in the Ahref attribute value to use the actual checkout URL.

This code does not require a filter since it overrides the default Proceed to Checkout text when we add it to the functions.php file on the active WooCommerce theme.

Conclusion

In this post, we have highlighted the way to change proceed to checkout text in the WooCommerce cart page and also shared the code that you should add to your functions.php file. Finally, you should not forget to change the text in the code to correspond to your preferred text.

Similar Articles

Comments are closed.