Show Checkout Even If Cart Is Empty

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.

To do so you just need to add this following snippet to your functions.php.

/**
 * @snippet       Avoid Empty Cart Redirect in WooCommerce Checkout
 * @author        Codeithub
 */
 
add_filter( 'woocommerce_checkout_redirect_empty_cart', '__return_false' );
add_filter( 'woocommerce_checkout_update_order_review_expired', '__return_false' );

Before:

See also  Display “product already in cart” instead of “add to cart” button
Checkout not available

After:

Checkout page is available

Leave a Reply

Your email address will not be published. Required fields are marked *