Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi All,
I have cloned https://github.com/Shopify/shopify-php-api and setup everything on local repo but when trying to call any API using some code, getting class file error Fatal error: Uncaught Error: Class "Shopify\Context" not found in E:\xamp\htdocs\ShopifyApp\shopify-php-api-official\CreateOrder.php:11
Below is the code on my page:
use Shopify\Clients\Rest;
use Shopify\Context;
use Shopify\Auth\FileSessionStorage;
Shopify\Context::initialize('APIKey', 'Secretey', 'write_assigned_fulfillment_orders, read_assigned_fulfillment_orders, write_customers, read_customers, write_discounts, read_discounts, write_draft_orders, read_draft_orders, write_files, read_files, write_fulfillments, read_fulfillments, write_gift_cards, read_gift_cards, write_inventory, read_inventory, write_order_edits, read_order_edits, write_orders, read_orders, write_payment_terms, read_payment_terms, write_price_rules, read_price_rules, write_product_listings, read_product_listings, write_products, read_products, write_reports, read_reports, write_script_tags, read_script_tags, write_shipping, read_shipping', 'store.myshopify.com', new FileSessionStorage('/tmp/php_sessions'), '2022-01');
$accessToken = 'AccessToken';
$client = new Rest("store", $accessToken);
$response = $client->get(
"/admin/oauth/access_scopes.json"
);
print_r($response);
Can you please guide me here so that I use the php library for custom App as private App is no longer exist. I tried to create the custom app from store itself.
Thanks in advance
Solved! Go to the solution
This is an accepted solution.
Hey did you add at beginning of file ?
require_once('vendor/autoload.php');
This is an accepted solution.
Hey did you add at beginning of file ?
require_once('vendor/autoload.php');
I have the same problem.
Can you help me?
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025