woocommerce_checkout_redirect_empty_cart

woocommerce_checkout_redirect_empty_cart

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.5.1

apply_filters('woocommerce_checkout_redirect_empty_cart') is found 2 times:

  • /includes/shortcodes/class-wc-shortcode-checkout.php line 346
    		// Show non-cart errors.
    		do_action( 'woocommerce_before_checkout_form_cart_notices' );
    
    		// Check cart has contents.
    		if ( WC()->cart->is_empty() && ! is_customize_preview() && apply_filters( 'woocommerce_checkout_redirect_empty_cart', true ) ) {
    			return;
    		}
    
    		// Check cart contents for errors.
    		do_action( 'woocommerce_check_cart_items' );
    
    
  • /includes/wc-template-functions.php line 31
    	}
    	// phpcs:enable WordPress.Security.NonceVerification.Recommended
    
    	// When on the checkout with an empty cart, redirect to cart page.
    	if ( is_page( wc_get_page_id( 'checkout' ) ) && wc_get_page_id( 'checkout' ) !== wc_get_page_id( 'cart' ) && WC()->cart->is_empty() && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) && ! is_customize_preview() && apply_filters( 'woocommerce_checkout_redirect_empty_cart', true ) ) {
    		wp_safe_redirect( wc_get_cart_url() );
    		exit;
    	}
    
    	// Logout endpoint under My Account page. Logging out requires a valid nonce.
    	if ( isset( $wp->query_vars['customer-logout'] ) ) {