Why is Woocommerce Order Update API Giving "HTTP ERROR 500"?

Viewed 97
    require __DIR__ . '/woo-api/vendor/autoload.php';
    use Automattic\WooCommerce\HttpClient\HttpClientException;
    use Automattic\WooCommerce\Client;
    $woocommerce = new Client(
        'https://mysite.info/', 
         $ck, 
         $cs,
        [
            'wp_api' => true, 'version' => 'wc/v3',
        ]
    );

    $data = ['status' => 'processing'];
    $woocommerce->put('orders/1242', $data); // Not Working

$woocommerce->get('products')); // Working
    
$woocommerce->get('products')); // Working
    
$woocommerce->get('customers',array('per_page' => 100, 'page' => $page)));// Working 
    
    
    
    

I'm trying to update order status .. but this is not working ! :( is there anything wrong with this code ?

$woocommerce->get('products')); => working 

$woocommerce->get('customers',array('per_page'=>100,'page' => $page)) => working 

With the same code I can get the customers data, product data...

but when I try to Update an order

its giving me "HTTP ERROR 500"

And the error log is mentioned Bellow Error Log :

/home2/wpqwerty/public_html/wooapi/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php(422): Automattic\WooCommerce\HttpClient\HttpClient->processResponse()

#1 /home2/wpqwerty/public_html/woo-api/vendor/automattic/woocommerce/src/WooCommerce/Client.php(69): Automattic\WooCommerce\HttpClient\HttpClient->request('orders/1242', 'PUT', Array)

#2 /home2/wpqwerty/public_html/test_api.php(16): Automattic\WooCommerce\Client->put('orders/1242', Array) #3 {main} thrown in /home2/wpqwerty/public_html/wooapi/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php on line 378

0 Answers
Related