title: Woocommerce rest api - Create product via ajax in wordpress
body: <p>Well, the problem is here. I created a local project to create a product in Woocommerce mounted in wordpress on a remote server. My local project code is this one</p>
  
  <pre><code>    &lt;?php
  require __DIR__ . '/vendor/autoload.php';
  use Automattic\WooCommerce\Client;
  function creaProd(){
  $precio = $_POST['Total'];
  $imagen = $_POST['Imagen'];
  $descrip = $_POST['Descripcion'];
  $tipo = $_POST['Tipo'];
  
  $woocommerce = new Client(
      'http://example.com',
      'ck_sdfsdfsdfsfdxxx',
      'cs_sdfsdfsfsdfaxxx',
      [
          'wp_api' =&gt; true,
          'version' =&gt; 'wc/v1',
      ]
  );
  
  $data = [
      'name' =&gt; $tipo,
      'type' =&gt; 'simple',
      'regular_price' =&gt; $precio,
      'description' =&gt; $descrip,
      'short_description' =&gt; $descrip,
      'categories' =&gt; [
          [
              'id' =&gt; 9
          ],
          [
              'id' =&gt; 14
          ]
      ],
      'images' =&gt; [
          [
              'src' =&gt; 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg',
              'position' =&gt; 0
          ],
          [
              'src' =&gt; 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg',
              'position' =&gt; 1
          ]
      ]
  ];
  
  print_r($woocommerce-&gt;post('products', $data));
  }
  creaProd();
  </code></pre>
  
  <p>And evertything works fine, the problem is, that I have tried a bunch of things, but I just don't get to create the product working in the wordpress project.</p>
  
  <p>I put it in the wp-includes folder and the wp-content, but didn't work. </p>
  
  <p>I tried to call an ajax to <code>example.com/wp-includes/myFile.php</code> but I can't reach it, I can reach files like <code>example.com/wp-includes/option.php</code> and all the files already there, but if I upload that one, I just can't, and I don't know where to put the vendor folder either. </p>
  
  <p>Which is the right way to integrate this project to my real site in Wordpress?</p>
  
  <p>Hope someone knows how to do this. Thanks.</p>