Add notice on empty cart when checking out
This commit is contained in:
parent
89af9e9416
commit
723b4109d2
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue