避免根据Woocommerce购物车中的特定产品添加到购物车

From this answer: Max number of items in a cart based on product category in Woocommerce, the following code works well:

add_filter( 'woocommerce_add_to_cart_validation', 'only_four_items_allowed_add_to_cart', 10, 3 );
function only_four_items_allowed_add_to_cart( $passed, $product_id, $quantity ) {
    $cart_count = WC()->cart->get_cart_contents_count();
    $total_count = $cart_count + $quantity;

    if ( has_term( 'quantity4','product_cat',$product_id ) && ( $cart_count >= 4 || $total_count > 4 ) ) {
        $passed = false; // Set to false
        $notice = __( "You Chose a Box of 4 Items, Can't Add More", "woocommerce" ); // Notice to display
    }
    elseif ( has_term( 'quantity6','product_cat',$product_id ) && ( $cart_count >= 6 || $total_count > 6 ) ) {
        $passed = false; // Set to false
        $notice = __( "You Chose a Box of 6 Items, Can't Add More", "woocommerce" ); // Notice to display
    }
    if( ! $passed )
        wc_add_notice( $notice, 'error' );

    return $passed;
}

I have 2 questions:

  1. When the user clicks 'add to cart' and that action makes the total quantity of items in the cart exceed the limit amount set in the code, the page redirects to that single product view and displays the error message. Is there a way to instead keep the user on the same page and display the error message?

  2. What I can't figure out is how to BYPASS that code IF a specific product is in the Cart. I've tried several varying options for items ( $in_cart ) or trying to unset( $plugins[$key] ) but I admit to being in over my head.

Simply stated, If Product '123' is in the cart, the above category product quantity limitations in the cart should NOT apply.

Can anyone provide guidance as to what else I should try?

Thank you.