I am new to Woocomerce Rest API.
I am trying to fetch all products from woocomerce in my new web application in php. But something went wrong from fetching that data. Here is my basic code :-
<?php
require_once ('vendorautoload.php');
use AutomatticWooCommerceClient;
$woocommerce = new Client(
'https://www.cotncurls.com',
'*************************',
'*************************',
[
'wp_api' => true,
'version' => 'wc/v3'
]
);
print_r($woocommerce->get('products'));
?>
But its showing me an error
Fatal error: Uncaught Error: Class 'AutomatticWooCommerceClient' not found in ....
How to resolve this ?
2
Answers
Error will remain same until we do not use exception class..
Here is the edited code.
Here in this case I see you are directly requiring the file from URL , i suggest you to download the library from github or run through composer