cliff
11/17/2016 - 10:34 PM

WooCommerce: redirect initial visit to Cart to Checkout instead to discourage users being able to edit the cart's contents after adding Tick

WooCommerce: redirect initial visit to Cart to Checkout instead to discourage users being able to edit the cart's contents after adding Tickets.

<?php

/**
 * WooCommerce: redirect initial visit to Cart to Checkout instead to discourage
 * users being able to edit the cart's contents after adding Tickets.
 *
 * Useful if only using WooCommerce for Event Tickets Plus,
 * not selling other Products.
 *
 * Updated 2018-01-17 to work with WooCommerce 2.5+ (released 2016-01-18).
 *
 * From https://gist.github.com/cliffordp/f148a9cacd726e5a86ffeda2d2e204c1
 *
 * @link https://gist.github.com/cliffordp/66bf05df61ee269c60ff20d6f39e2cab Make Cart quantities readonly.
 * @link https://theeventscalendar.com/support/forums/topic/how-do-i-skip-the-view-cart-phase-to-sidestep-missing-attendee-info-bugs/
 * @see  wc_get_cart_url()
 * @see  wc_get_checkout_url()
 */
function cliff_redirect_woo_cart_to_checkout( $url ) {
	return esc_url_raw( wc_get_checkout_url() );
}

add_filter( 'woocommerce_get_cart_url', 'cliff_redirect_woo_cart_to_checkout' );