title: Disable ajax add to cart on first item and custom redirect it on Woocommerce
body: <p>Hi I am working on a WOOCOMMERCE site and
  I am trying to redirect user to a custom page when the user tries to add his first product into the cart. </p>
  
  <p>The redirection should be done only for the first product in the cart.</p>
  
  <p>When the user adds two or more products in the cart then the normal ajax add to cart should function.</p>
  
  <p>Firstly I tried redirecting to custom page for the first product by using the function below</p>
  
  <pre><code>function my_custom_add_to_cart_redirect( $url ) {  
      if (WC()-&gt;cart-&gt;get_cart_contents_count() == 0)
      $url = get_permalink( 1172 ); /* ID of the page is entered */
      return $url;
      }
  add_filter( 'woocommerce_add_to_cart_redirect', 'my_custom_add_to_cart_redirect' );
  </code></pre>
  
  <p>The above code does redirect to custom page but it happens for all product additions to cart.</p>
  
  <p>Moreover it does not work when "Redirect to the cart page after successful addition" field is unchecked in WOOCommerce Settings.</p>
  
  <p>Can anyone help me with the right approach ?</p>