I got the below code and I want to work on woocommerce api to work on orders. So I got the below code able to get all particular order details by order id. But I am not getting custom field value from orders which is added.
require __DIR__ . '/vendor/autoload.php';
use Automattic\WooCommerce\Client;
use Automattic\WooCommerce\HttpClient\HttpClientException;
$woocommerce = new Client(
'www.abc.com', // Your store URL
'ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // Your consumer key
'cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // Your consumer secret
[
'wp_api' => true, // Enable the WP REST API integration
'version' => 'wc/v3' // WooCommerce WP REST API version
]
);
$products = $woocommerce->get('products');
print_r( $woocommerce->orders->get( $order_id ) );
Thanks in advance for helping me out from this.