May 26, 2015

Woocommerce how to add to cart button direct redirect to checkout page?

Yes its possible using a simple wordpress function.

Please add following function in your theme functions.php file.

add_filter ('add_to_cart_redirect', 'redirect_checkout');

function redirect_checkout() {
    global $woocommerce;
    $checkout_url = $woocommerce->cart->get_checkout_url();
    return $checkout_url;
}

In the latest version of wordperss you also used following shot function.

function redirect_to_checkout() {
    return WC()->cart->get_checkout_url();

}

Enjoy!

No comments:

Post a Comment

The Future of Technology: Emerging Trends to Watch in 2025

Introduction As we navigate through 2025, the technological landscape continues to evolve at an unprecedented pace. Innovations that once se...