title: WooCommerce display upsells products in a popup on category page
body: <p>On a category page, when user click on "add to cart" button i want to show upsell products related to that specific product in a poupup, so that user has the option to add upsells products in cart along with that product.</p>
  
  <pre><code>&lt;script&gt;
  jQuery(function() {
      jQuery(".single_add_to_cart_button, .add_to_cart_button").click(function(evt) {
          //evt.preventDefault();
          var product_id = jQuery(this).attr("data-product_id");
  
          jQuery.ajax({
              type: "POST",
              url: "&lt;?php echo get_site_url(); ?&gt;/wp-admin/admin-ajax.php",
              data: {action: 'myajax-submit', id: product_id},
              cache: false,
              success: function(data) {
                  jQuery("#result").html(data);
              }
          });
          //return false;
      })
  
  })
  </code></pre>
  
  <p></p>
  
  <p>in the functions.php i have written the following code</p>
  
  <pre><code>add_action( 'wp_ajax_nopriv_myajax-submit', 'myajax_submit' );
  add_action( 'wp_ajax_myajax-submit', 'myajax_submit' );
  function myajax_submit(){
    $product_id = $_REQUEST['id'];
  }
  </code></pre>