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.8.7.0

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 30
    	}
    	// 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.