<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[woocommerce creare prodotti via PHP]]></title><description><![CDATA[<p dir="auto">Ciao.<br />
Sto provando del codice php con l'intento di creare un prodotto woocommerce, l'intenzione è quella di creare poi dinamicamente più prodotti.<br />
Vi posto il codice:</p>
<pre><code>$api_response = wp_remote_post( 'nomeSito/my-orders/', array(
    'headers' =&gt; array(
      'Authorization' =&gt; 'Basic ' . base64_encode( 'ck_453641***********1725c113ba:cs_e2d8************5cea' )
    ),
    'body' =&gt; array(
      'username' =&gt; 'abe001.eu@gmail.com',
      'name' =&gt; 'My test2', // product title
      'categories' =&gt; array(
        array(
          'id' =&gt; 17 // each category in a separate array
        )
      /*    array(
          'id' =&gt; 10
        )*/
      ),
      'regular_price' =&gt; '9.99' // product price
    )
  ) );

  $body = json_decode( $api_response['body'] );
  //echo "&lt;pre&gt;".print_r( $body )."&lt;/pre&gt;";

  if( wp_remote_retrieve_response_message( $api_response ) == 'Created' ) {
    echo 'The product ' . $body-&gt;name . ' has been created';
  }
  else {
    echo "ERROR";
  }
</code></pre>
<p dir="auto">Lo script restituisce sempre errore.</p>
]]></description><link>https://dev.connect.gt/topic/241442/woocommerce-creare-prodotti-via-php</link><generator>RSS for Node</generator><lastBuildDate>Fri, 27 Nov 2026 10:54:03 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/241442.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 16 May 2020 20:57:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to woocommerce creare prodotti via PHP on Sun, 17 May 2020 08:25:13 GMT]]></title><description><![CDATA[<p dir="auto">Penso che il problema sia nell'url, non conosco il link alle woocommerce v3</p>
]]></description><link>https://dev.connect.gt/post/1268996</link><guid isPermaLink="true">https://dev.connect.gt/post/1268996</guid><dc:creator><![CDATA[abe001]]></dc:creator><pubDate>Sun, 17 May 2020 08:25:13 GMT</pubDate></item></channel></rss>