Home » WooCommerce: Show Checkout Even If Cart Is Empty

WooCommerce: Show Checkout Even If Cart Is Empty

by Tutor Aspire

By default, the WooCommerce Checkout page redirects you back to the (empty) Cart page in case there are no products in the Cart.

Now, there are times when you still need users to see the Checkout page and avoid this redirect. And thankfully, WooCommerce provides us with two filters that we can use to immediately disable this default behavior. Enjoy!

Checkout page by default redirects to the empty WooCommerce Cart page when no products are in the Cart

PHP Snippet: Avoid Checkout Redirect to Empty Cart

/**
 * @snippet       Avoid Empty Cart Redirect @ WooCommerce Checkout
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WooCommerce 3.6.4
 * @donate $9     https://www.tutoraspire.com
 */

add_filter( 'woocommerce_checkout_redirect_empty_cart', '__return_false' );
add_filter( 'woocommerce_checkout_update_order_review_expired', '__return_false' );

You may also like