Q: Woocommerce RestAPI not working properly 401 Error code I've been trying to Get products details from my existing wordpress woocomerce website. I have created the Key and able to get data when use $woocommerce->get('') but when use $woocommerce->get('orders') or $woocommerce->get('products') it's giving 401 error.
Following is my code:
<?php
require __DIR__ . '/vendor/autoload.php';

use Automattic\WooCommerce\Client;
use Automattic\WooCommerce\HttpClient\HttpClientException;

$woocommerce = new Client(
    
    'https://mycustomdomain.com', 
    'ck_XXXXXXXXXXXXXXXXXXXXXXXXXX', 
    'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXX',
    [
        'wp_api' => true,
        'version' => 'wc/v3',
        'query_string_auth' => true,
    ]
);


    $results = $woocommerce->get('orders');
    //$results = $woocommerce->get('');

    echo "<pre>";
    print_r($results);
    echo "</pre>";

I have also uninstalled all the plugins and upgraded the PHP version to the latest one and also, increased the memory which is now 256m but nothing works properly.

A: //maybe if you change this:

[
        'wp_api' => true,
        'version' => 'wc/v3',
        'query_string_auth' => true,
]

// enter code here

to this:

[
        'wp_api' => false,
        'version' => 'wc/v3',
        'query_string_auth' => false,
]

