REST API Client Class Not Found
-
I keep getting this issue when I try to connect to my woocommerce API.
Fatal error: Uncaught Error: Class ‘Automattic\WooCommerce\Client’ not found in /home/woorayzist/public_html/wp-content/themes/Divi-child/functions.php:258 Stack trace: #0 /home/woorayzist/public_html/wp-includes/class-wp-hook.php(287): woo_new_product_tab(Array) #1 /home/woorayzist/public_html/wp-includes/plugin.php(206): WP_Hook->apply_filters(Array, Array) #2 /home/woorayzist/public_html/wp-content/themes/Divi/includes/builder/module/helpers/WooCommerceModules.php(904): apply_filters(‘woocommerce_pro…’, Array) #3 /home/woorayzist/public_html/wp-includes/class-wp-hook.php(287): ET_Builder_Module_Helper_Woocommerce_Modules::get_woo_default_tabs_options(‘include_tabs’) #4 /home/woorayzist/public_html/wp-includes/plugin.php(206): WP_Hook->apply_filters(‘include_tabs’, Array) #5 /home/woorayzist/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(2280): apply_filters(‘et_builder_get_…’, ‘include_tabs’) #6 /home/woorayzist/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-e in /home/woorayzist/public_html/wp-content/themes/Divi-child/functions.php on line 258
Whereas my composer folder is located in wp-content. I also call in the files as:
require_once WP_CONTENT_DIR . '/composer/vendor/autoload.php'; use Automattic\WooCommerce\Client; use Automattic\WooCommerce\HttpClient\HttpClientException;
My permalinks are set as:
/store/%product_cat%/
for products.My code to connect is:
$woocommerce = new Client( 'https://woo.rayzist.com/store', 'ck_###', 'cs_###', [ 'wp_api' => true, 'version' => 'wc/v3', 'query_string_auth' => true # Force Basic Authentication as query string true and using under HTTPS ] );
- The topic ‘REST API Client Class Not Found’ is closed to new replies.