Skip Cart Woocommerce |

Hi guys, I added below code to skip cart in Woo.

// Skip cart - straight to checkout
add_filter('add_to_cart_redirect', 'obs_skip_cart_page');
function obs_skip_cart_page () {
global $woocommerce;
$redirect_checkout = $woocommerce->cart->get_checkout_url();
return $redirect_checkout;

It works fine. But I get this message from Query Monitor plugin.

Hook add_to_cart_redirect is deprecated since version 3.0.0! Use woocommerce_add_to_cart_redirect instead.

Function WC_Cart::get_checkout_url is deprecated since version 2.5! Use wc_get_checkout_url instead.+

Can you guys help me updating this code to the latest Woo version.


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer