WP woocommerce change "Proceed to checkout" buttons URL WP woocommerce change "Proceed to checkout" buttons URL wordpress wordpress

WP woocommerce change "Proceed to checkout" buttons URL


the best way is the woocommerce hooks

Try to use this code (put it in your functions.php theme file).

add_filter( 'woocommerce_get_checkout_url', 'my_change_checkout_url', 30 );function my_change_checkout_url( $url ) {   $url = "your checkout url ";   return $url;}

You can customize it by adding some conditions to change the checkout url

for example:

add_filter( 'woocommerce_get_checkout_url', 'my_change_checkout_url', 30 );function my_change_checkout_url( $url ) {    $allowed_countries = array('FR');    $customer_country = WC()->customer->get_default_country();    if( !in_array( $customer_country , $allowed_countries ) ) {        $url = wc_get_page_permalink( 'other-checkout' );    }    return $url;}


It should be available at below path

wp-content/plugins/woocommerce/templates/cart/proceed-to-checkout-button.php


Change Proceed To Checkout Text In WooCommerce* Change Proceed To Checkout Text in WooCommerce* Place this in your Functions.php fileThis is the new method, for version 2.3.8 of WooCommerce and forward.

<?phpfunction woocommerce_button_proceed_to_checkout() {       $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     }