This customization is implemented by store owners when some integrated payment gateways require redirection to an external page for payment processing. In such cases, this code snippet is helpful such that when user clicks ‘Proceed to checkout’ on the cart page, they will be redirected to a custom URL.
add_filter('woocommerce_get_checkout_url', 'ts_redirect_checkout'); function ts_redirect_checkout($url) { global $woocommerce; $checkout_url = 'http://your-custom-url.com'; return $checkout_url; }
Output
When user clicks on ‘Proceed to Button’ they will be redirected to the custom URL page specified in the code.
Instead of redirecting, you can also remove the proceed to checkout button from cart page in WooCommerce in cases of having external payment options such as Paypal in your store.