Add notice on empty cart when checking out

This commit is contained in:
Mike Jolley 2016-03-07 10:31:01 +00:00
parent 89af9e9416
commit 723b4109d2
1 changed files with 1 additions and 0 deletions

View File

@ -28,6 +28,7 @@ function wc_template_redirect() {
// When on the checkout with an empty cart, redirect to cart page
elseif ( is_page( wc_get_page_id( 'checkout' ) ) && WC()->cart->is_empty() && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) ) {
wc_add_notice( __( 'Checkout is not available whilst your cart is empty.', 'woocommerce' ) );
wp_redirect( wc_get_page_permalink( 'cart' ) );
exit;
}