title: Additional Woocommerce product Add To Cart button that redirect to checkout
body: <p>I need the customer to be able to choose between add to cart and continue to shop and add to cart and get re-directed to the checkout. In other words, I'm adding a extra button to the product page.</p>
  
  <p>Being new to WooCommerce, I'm struggling getting the qty input to function. It works fine if buying just one, but not when adding more than one (qty).</p>
  
  <p>Also, I'm failing to understand how to add support for variable products, but that might be a separate question? (sorry if so).</p>
  
  <p>Here's the code I'm using:</p>
  
  <pre><code>add_action( 'woocommerce_after_add_to_cart_button', 'add_content_after_addtocart' );
  function add_content_after_addtocart() {
      $current_product_id = get_the_ID();
      $product = wc_get_product( $current_product_id );
      $checkout_url = WC()-&gt;cart-&gt;get_checkout_url();
      if( $product-&gt;is_type( 'simple' )) { ?&gt;
          &lt;script&gt;
          jQuery(function($) {
              $(".custom-checkout-btn").on("click", function() {
                  $(this).attr("href", function() {
                      return this.href + '&amp;quantity=' + $('input.qty').val();
                  });
              });
          });
          &lt;/script&gt;
          &lt;?php
          echo '&lt;a href="'.$checkout_url.'?add-to-cart='.$current_product_id.'" class="single_add_to_cart_button button alt"&gt;Buy &amp;amp; Checkout&lt;/a&gt;';
      } 
  }
  </code></pre>
  
  <p>Any input on where I'm going wrong? All the help I can get is appreciated.</p>