How to change url in “View Cart” button in Woocommerce

woocommerce

How to change url in "View Cart" button in Woocommerce which shows after clicking "Add to cart" button? I have default http://myshop.com/checkout and I want to change url to custom page (with my cart view combined with checkout): http://myshop.com/custom-page

I know that I should change js behavior, but how?

Best Answer

You can filter the checkout url via woocommerce_get_checkout_url

function so_37863005_checkout_url( $url ){

    // Force SSL if needed
    $scheme = ( is_ssl() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) ) ? 'https' : 'http';
    $url = site_url( '/custom-page/', $scheme );

    return $url;
}
add_filter( 'woocommerce_get_checkout_url', 'so_37863005_checkout_url', 10, 2 );
Related Topic