shopify
shopify copied to clipboard
Shopify Checkout API Ending April 1, 2025
We just got a notice from Shopify that they will end support for the storefront and admin checkout API that this plugin uses:
Migrate to the Storefront Cart API
Are there plans to migrate this plugin to their new API before April?
Any updates re this?
@fbnntt I think you are referring to the Checkout API, the plugin uses the admin REST API to get and sync the products so I think we are unaffected? Can you point out specifically what we are doing in the API that is being deprecated?
@lukeholder It's hard to find info on that, but everywhere on the admin REST API, there is a message that it's deprecated since October 1, 2024 (https://shopify.dev/docs/api/admin-rest). And starting April 1, 2025, all new apps created must be GraphQL: https://shopify.dev/changelog/starting-april-2025-new-public-apps-submitted-to-shopify-app-store-must-use-graphql So, ideally, the Craft Shopify plugin should be updated to use the GraphQL api before April, or otherwise, it won't work for people creating new apps.
@smcyr Thanks, I see the warning in the docs for admin-rest. We will get this plugin upgraded before the cut-off date.
Is there any updates on this one? Shopify is starting to get loud on the deprecations!
Hi @rjgux
This is something that we are currently working on, we have a draft PR for this.
It is currently work-in-progress, we will make sure to update this issue with any progress.
Thanks!
Hey guys, really happy to see there's been some recent movement on this with the draft PR. Thank you!
I'd like to point out that we are now just a little over 6 weeks out from when this API is going to stop working. We as site owners need a reasonable amount of time to run (and test) the necessary upgrades.
But while this Issue remains open, we don't know what a "reasonable amount of time" is. Will there be a clear a upgrade path? Will there be breaking changes?
All of this is to say, I really hope to see this issue addressed ASAP. If not, it puts all of our own sites (and relationships with clients) at risk.
🙏
I'd like to point out that we are now just a little over 6 weeks out from when this API is going to stop working.
From what I can read from Shopify, the API will still be working for existing apps on April 1st. It's only new Shopify organizations that won't be able to create new custom apps using the REST API: https://shopify.dev/changelog/starting-april-2025-new-public-apps-submitted-to-shopify-app-store-must-use-graphql https://shopify.dev/changelog/deprecation-timelines-related-to-new-graphql-product-apis
Custom apps built on REST that do not need to support more than 100 variants can continue to use the deprecated REST product APIs, however it is important to note: -Developers should expect that the GraphQL API will be the only supported API over the long term and will be made aware of these timelines as they become available. -The deprecated REST product APIs are in maintenance mode; all new features and support will be built only for the new GraphQL product APIs. -Any merchant using custom apps built with these deprecated APIs will not be able to increase their variant limit past 100.
@smcyr I appreciate the clarification, thank you.
However I don't think it's a tenable solution so say that this plugin works, as long as you integrate it by April 1. It's tied to a deprecated API, which has some important limitations that affect other features of this plugin (e.g. https://github.com/craftcms/shopify/issues/90).
I also don't think what this issue is asking for is unreasonable, nor is my ask that it be addressed in a timely manner.
Hi All
Thank you for the messages.
We understand that this is a time-sensitive issue/update and are working to get something out as soon as we can. We would like to get a beta out at the end of this week/beginning of next. It would be great to get feedback on people updating the plugin.
We are trying to negate breaking changes where we can, although there are some discrepancies between the data the REST and GQL APIs return. With how people use the plugin in the wild a beta could be a great place to learn where we can make changes to ensure the transition is as seamless as possible.
Please let us know if you have any other questions or specific queries.
Thanks!
Hello @nfourtythree , do you think we’re going to have GraphQL support in the next 6.x release ? thank !
Hi @stephanedemotte
Thank you for your question.
Full GraphQL support is something on our list/radar: https://github.com/craftcms/shopify/discussions/49
We are just concentrating on completing the conversion of the integration with the Shopify API so that it works for everyone.
Once that is done we will have a clear path for new features. With that, it will unlikely make it into 6.0 but we can look at it for 6.1.
Thanks
Hey guys, are there any updates on this at all?
@TGriffiths88 feedme + element api is the way, for me :)
'api/products.json' => function() {
return [
'cache' => false,
'one' => true,
'elementType' => Entry::class,
'transformer' => function() {
$client = new Client();
$response = $client->get("https://" . App::env('SHOPIFY_HOSTNAME') . "/admin/api/" . App::env('SHOPIFY_VERSION') . "/products.json", [
'headers' => [ 'X-Shopify-Access-Token' => App::env('SHOPIFY_TOKEN'), 'Content-Type' => 'application/json'],
'query' => [ 'limit' => 1, 'page_info' => Craft::$app->request->getParam('page_info', null)],
]);
$data = json_decode($response->getBody()->getContents(), true);
$pagination = $response->getHeader('Link');
$next = null;
if (!empty($pagination)) {
$links = explode(',', $pagination[0]);
foreach ($links as $link) {
if (strpos($link, 'rel="next"') !== false) {
preg_match('/page_info=([^&>]+)/', $link, $matches);
$next = $matches[1] ?? null;
}
}
}
$products = [];
foreach($data['products'] as $key => $p):
$products[] = [
'id' => $p['id'],
'title' => $p['title'],
'media' => $p['image']['src'],
'raw' => json_encode($p)
];
endforeach;
return [
'next' => App::env('PRIMARY_SITE_URL') . '/api/products.json?page_info=' . $next,
'products' => $products ?? [],
];
},
];
},
Hi All
We are pleased to say that we have just pushed a beta of the new version of the Shopify plugin (6.0.0-beta.1). This has all the changes for moving away from the Admin REST API and to the Admin GraphQL API.
We have updated the README with the new details (and are continuing to improve on this) please pay careful attention to the upgrading section which details differences that will be of note for your projects.
To get this version, change your craftcms/shopify requirement in your project's composer.json to:
"require": {
"craftcms/shopify": "^6.0.0-beta.1",
"...": "..."
}
Then run composer update.
Looking forward to your feedback on this version! Please let us know if you come up against any issues.
We please ask that if you have any issues related to the new version that you create new issues for them in this repo so we can efficiently track everything.
Thanks!
Hey @nfourtythree , thanks for this beta. Just tried to install and got migration error
Exception: SQLSTATE[42703]: Undefined column: 7 ERROR: column "gid://shopify/Product/" does not exist
LINE 1: UPDATE "shopify_products" SET "shopifyGid"=CONCAT("gid://sho...
^
The SQL being executed was: UPDATE "shopify_products" SET "shopifyGid"=CONCAT("gid://shopify/Product/", "shopifyId")
PHP 8.3.16 PostgreSQL 14.15 Craft Pro 5.6.11
Hi @alex-brukhty
Thank you for bringing this to our attention. We have just pushed out version 6.0.0-beta.2 which addresses this issue.
Please update and let us know how you get on.
Thanks!
I'm still running a site on Craft 4 with craft/shopify: ^4.0. Am I obliged to upgrade the entire site to Craft 5 for this?
Hi @mdominguez
You do not need to update Craft, this plugin supports Craft CMS 4.3.0+ or 5.0.0+.
Thanks!
Hey @nfourtythree I am having trouble updating the plugin on Craft 4. I'm getting a few errors referencing code only available in Craft 5.
When running migrations:
Exception: Calling unknown method: craft\db\mysql\QueryBuilder::jsonExtract() from craft\shopify\migrations\m250212_134453_create_virtual_columns line 36
When in the control panel:
Class "craft\enums\Color" not found from craft\shopify\helpers\Product line 161
Call to undefined method craft\helpers\Cp::statusLabelHtml() from craft\shopify\helpers\Product line 165
Hi @nichxlson
Thank you for bringing this to our attention. We will look into it and make updates to ensure the compatibility with Craft 4 remains.
Will update you with the progress as soon as we can.
Thanks!
Hi @nichxlson
There were fixes that were required in both the plugin and Craft 4.x itself. We have just pushed up version 6.0.0-beta.3 of the Plugin.
The changes for Craft needed to go into the upcoming 4.15.0 release which isn't out just yet.
To get this early, change your craftcms/cms requirement in your project's composer.json to:
"require": {
"craftcms/cms": "4.15.x-dev as 4.14.10",
"...": "..."
}
Then run composer update.
With these two updates you should be able to get everything up, running and upgraded without an issue.
Please let us know if you do hit any further problems.
When 4.15.0 of Craft is officially released we will make that a required version for people using this plugin with Craft 4.
Thanks!
Hi @nfourtythree
In the Product element class (src/elements/Product.php), the defineSortOptions() method is using shopify_productdata as an alias in the orderBy parameters. However, this table is not part of the Shopify plugin’s current schema (as of 6.x), which results in an SQL error when sorting products in the control panel or when querying them programmatically.
Current implementation:
protected static function defineSortOptions(): array
{
$sortOptions = parent::defineSortOptions();
$sortOptions['title'] = [
'label' => Craft::t('app', 'Title'),
'orderBy' => 'shopify_productdata.title',
'defaultDir' => SORT_DESC,
];
$sortOptions['shopifyId'] = [
'label' => Craft::t('shopify', 'Shopify ID'),
'orderBy' => 'shopify_productdata.shopifyId',
'defaultDir' => SORT_DESC,
];
$sortOptions['shopifyStatus'] = [
'label' => Craft::t('shopify', 'Shopify Status'),
'orderBy' => 'shopify_productdata.shopifyStatus',
'defaultDir' => SORT_DESC,
];
return $sortOptions;
}
Issue:
When executing an element query or viewing the product list in the CP, the following error is thrown:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'shopify_productdata.shopifyId' in 'order clause'
This happens because the shopify_productdata table/alias does not exist in the generated query or in the database schema.
Suggested fix: Update the sort options to use the correct aliases based on the current schema (likely shopify_products and shopify_data as used in the query joins). For example:
$sortOptions['shopifyId'] = [
'label' => Craft::t('shopify', 'Shopify ID'),
'orderBy' => 'shopify_products.shopifyId',
'defaultDir' => SORT_DESC,
];
$sortOptions['shopifyStatus'] = [
'label' => Craft::t('shopify', 'Shopify Status'),
'orderBy' => 'data.shopifyStatus',
'defaultDir' => SORT_DESC,
];
Environment: Craft CMS: 5.6.13 Shopify plugin: 6.x
Thanks! 🙏
Hi @mauricepattyn
Thank you for bringing this to our attention.
We have just released version 6.0.0-beta.4 of the plugin which solves this issue.
Thanks!
Got this error when - after plugin update - it try to update the database
Database Exception: SQLSTATE[HY000]: General error: 3780 Referencing column 'shopifyGid' and referenced column 'shopifyId' in foreign key constraint 'fk_lrisrxozhmplwpyfkprvplndbfojwwvawkkr' are incompatible.
The SQL being executed was: ALTER TABLE shopify_products ADD CONSTRAINT fk_lrisrxozhmplwpyfkprvplndbfojwwvawkkr FOREIGN KEY (shopifyGid) REFERENCES shopify_data (shopifyId)
Migration: craft\shopify\migrations\m250212_135301_add_shopify_gid_column_for_products
Output:
> add column shopifyGid string AFTER shopifyId to table {{%shopify_products}} ... done (time: 0.006s)
> dropping foreign key on {{%shopify_products}} if it exists ... done (time: 0.010s)
> create unique index idx_wyaqekfzjlfunizpuwwdzlvjpvdjtyyxyhwj on {{%shopify_products}} (shopifyGid) ... done (time: 0.017s)
> add foreign key fk_lrisrxozhmplwpyfkprvplndbfojwwvawkkr: {{%shopify_products}} (shopifyGid) references {{%shopify_data}} (shopifyId) ...Exception: SQLSTATE[HY000]: General error: 3780 Referencing column 'shopifyGid' and referenced column 'shopifyId' in foreign key constraint 'fk_lrisrxozhmplwpyfkprvplndbfojwwvawkkr' are incompatible.
The SQL being executed was: ALTER TABLE shopify_products ADD CONSTRAINT fk_lrisrxozhmplwpyfkprvplndbfojwwvawkkr FOREIGN KEY (shopifyGid) REFERENCES shopify_data (shopifyId) (/var/www/html/vendor/yiisoft/yii2/db/Schema.php:676)
#0 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1325): yii\db\Schema->convertException(Object(PDOException), 'ALTER TABLE sh...')
#1 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1120): yii\db\Command->internalExecute('ALTER TABLE sh...')
#2 /var/www/html/vendor/yiisoft/yii2/db/Migration.php(478): yii\db\Command->execute()
#3 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(454): yii\db\Migration->addForeignKey('fk_lrisrxozhmpl...', '{{%shopify_prod...', Array, '{{%shopify_data...', Array, NULL, NULL)
#4 /var/www/html/vendor/craftcms/shopify/src/migrations/m250212_135301_add_shopify_gid_column_for_products.php(24): craft\db\Migration->addForeignKey(NULL, '{{%shopify_prod...', Array, '{{%shopify_data...', Array, NULL, NULL)
#5 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(50): craft\shopify\migrations\m250212_135301_add_shopify_gid_column_for_products->safeUp()
#6 /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php(233): craft\db\Migration->up(true)
#7 /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php(149): craft\db\MigrationManager->migrateUp(Object(craft\shopify\migrations\m250212_135301_add_shopify_gid_column_for_products))
#8 /var/www/html/vendor/craftcms/cms/src/services/Updates.php(252): craft\db\MigrationManager->up()
#9 /var/www/html/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(499): craft\services\Updates->runMigrations(Array)
#10 /var/www/html/vendor/craftcms/cms/src/controllers/UpdaterController.php(213): craft\controllers\BaseUpdaterController->runMigrations(Array, 'restore-db')
#11 [internal function]: craft\controllers\UpdaterController->actionMigrate()
#12 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#13 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#14 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('migrate', Array)
#15 /var/www/html/vendor/craftcms/cms/src/web/Application.php(361): yii\base\Module->runAction('updater/migrate', Array)
#16 /var/www/html/vendor/craftcms/cms/src/web/Application.php(753): craft\web\Application->runAction('updater/migrate')
#17 /var/www/html/vendor/craftcms/cms/src/web/Application.php(274): craft\web\Application->_processUpdateLogic(Object(craft\web\Request))
#18 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /var/www/html/web/index.php(12): yii\base\Application->run()
#20 {main}
Got this error when - after plugin update - it try to update the database
Database Exception: SQLSTATE[HY000]: General error: 3780 Referencing column 'shopifyGid' and referenced column 'shopifyId' in foreign key constraint 'fk_lrisrxozhmplwpyfkprvplndbfojwwvawkkr' are incompatible. The SQL being executed was: ALTER TABLE shopify_products ADD CONSTRAINT fk_lrisrxozhmplwpyfkprvplndbfojwwvawkkr FOREIGN KEY (shopifyGid) REFERENCES shopify_data (shopifyId) Migration: craft\shopify\migrations\m250212_135301_add_shopify_gid_column_for_products Output: > add column shopifyGid string AFTER shopifyId to table {{%shopify_products}} ... done (time: 0.006s) > dropping foreign key on {{%shopify_products}} if it exists ... done (time: 0.010s) > create unique index idx_wyaqekfzjlfunizpuwwdzlvjpvdjtyyxyhwj on {{%shopify_products}} (shopifyGid) ... done (time: 0.017s) > add foreign key fk_lrisrxozhmplwpyfkprvplndbfojwwvawkkr: {{%shopify_products}} (shopifyGid) references {{%shopify_data}} (shopifyId) ...Exception: SQLSTATE[HY000]: General error: 3780 Referencing column 'shopifyGid' and referenced column 'shopifyId' in foreign key constraint 'fk_lrisrxozhmplwpyfkprvplndbfojwwvawkkr' are incompatible. The SQL being executed was: ALTER TABLE shopify_products ADD CONSTRAINT fk_lrisrxozhmplwpyfkprvplndbfojwwvawkkr FOREIGN KEY (shopifyGid) REFERENCES shopify_data (shopifyId) (/var/www/html/vendor/yiisoft/yii2/db/Schema.php:676) #0 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1325): yii\db\Schema->convertException(Object(PDOException), 'ALTER TABLE sh...') #1 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1120): yii\db\Command->internalExecute('ALTER TABLE sh...') #2 /var/www/html/vendor/yiisoft/yii2/db/Migration.php(478): yii\db\Command->execute() #3 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(454): yii\db\Migration->addForeignKey('fk_lrisrxozhmpl...', '{{%shopify_prod...', Array, '{{%shopify_data...', Array, NULL, NULL) #4 /var/www/html/vendor/craftcms/shopify/src/migrations/m250212_135301_add_shopify_gid_column_for_products.php(24): craft\db\Migration->addForeignKey(NULL, '{{%shopify_prod...', Array, '{{%shopify_data...', Array, NULL, NULL) #5 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(50): craft\shopify\migrations\m250212_135301_add_shopify_gid_column_for_products->safeUp() #6 /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php(233): craft\db\Migration->up(true) #7 /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php(149): craft\db\MigrationManager->migrateUp(Object(craft\shopify\migrations\m250212_135301_add_shopify_gid_column_for_products)) #8 /var/www/html/vendor/craftcms/cms/src/services/Updates.php(252): craft\db\MigrationManager->up() #9 /var/www/html/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(499): craft\services\Updates->runMigrations(Array) #10 /var/www/html/vendor/craftcms/cms/src/controllers/UpdaterController.php(213): craft\controllers\BaseUpdaterController->runMigrations(Array, 'restore-db') #11 [internal function]: craft\controllers\UpdaterController->actionMigrate() #12 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #13 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array) #14 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('migrate', Array) #15 /var/www/html/vendor/craftcms/cms/src/web/Application.php(361): yii\base\Module->runAction('updater/migrate', Array) #16 /var/www/html/vendor/craftcms/cms/src/web/Application.php(753): craft\web\Application->runAction('updater/migrate') #17 /var/www/html/vendor/craftcms/cms/src/web/Application.php(274): craft\web\Application->_processUpdateLogic(Object(craft\web\Request)) #18 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request)) #19 /var/www/html/web/index.php(12): yii\base\Application->run() #20 {main}
I've got the same error above.
With the 1st of April upon us. When are we expecting this plugin to be ready for production as it seems there's still issues like mentioned above?
It might be worth communicating that you can still use the current version and the API will still work with existing apps (for now) but new apps wont be able to be created in Shopify (as far as I understand).
So there is urgency but also it's ok if existing setups aren't quite upgrade yet?!
Hi @plcdnl & @thilan-plato
Our apologies, we thought the fix for that issue had already gone out in a previous beta version. We have just released 6.0.0-beta.5 which has that fix in it. You should be able to upgrade with that version without any issues.
With the 1st of April upon us. When are we expecting this plugin to be ready for production as it seems there's still issues like mentioned above?
It might be worth communicating that you can still use the current version and the API will still work with existing apps (for now) but new apps wont be able to be created in Shopify (as far as I understand).
So there is urgency but also it's ok if existing setups aren't quite upgrade yet?!
@mylesthedev We have be fixing any issues reported as they arise. The issue you referenced is now fixed but was one that didn't affect everyone, we don't believe that means there are issues with the plugin.
We believe the plugin is production ready, we are only holding off on a full tagged 6.0.0 release because if you are using the plugins with Craft 4.x you need to be using the pre-release 4.15 version of the CMS (as mentioned in this comment). As soon as 4.15 is released we will tag 6.0.
Your understanding looks to be the same as ours in the fact that, for the moment, apps will continue to work if they have already been created.
Hope this information helps, thanks!
`SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (utf8mb4_0900_ai_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '=' The SQL being executed was: SELECT `elements`.`id`, `elements`.`canonicalId`, `elements`.`fieldLayoutId`, `elements`.`uid`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateLastMerged`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_sites`.`id` AS `siteSettingsId`, `elements_sites`.`siteId`, `elements_sites`.`title`, `elements_sites`.`slug`, `elements_sites`.`uri`, `elements_sites`.`content`, `elements_sites`.`enabled` AS `enabledForSite`, `shopify_products`.`shopifyId`, `shopify_products`.`shopifyGid`, `data`.`shopifyStatus`, `data`.`handle`, `data`.`productType`, `data`.`createdAt`, `data`.`publishedAt`, `data`.`publishedOnCurrentPublication`, `data`.`tags`, `data`.`templateSuffix`, `data`.`updatedAt`, `data`.`vendor`, `data`.`options`, `data`.`data`, `elements`.`draftId`, `drafts`.`creatorId` AS `draftCreatorId`, `drafts`.`provisional` AS `isProvisionalDraft`, `drafts`.`name` AS `draftName`, `drafts`.`notes` AS `draftNotes` FROM (SELECT `elements`.`id` AS `elementsId`, `elements_sites`.`id` AS `siteSettingsId` FROM `elements` `elements` INNER JOIN `shopify_products` `shopify_products` ON `shopify_products`.`id` = `elements`.`id` INNER JOIN `shopify_data` `data` ON `data`.`shopifyId` = `shopify_products`.`shopifyGid` INNER JOIN `elements_sites` `elements_sites` ON `elements_sites`.`elementId` = `elements`.`id` LEFT JOIN `drafts` `drafts` ON `drafts`.`id` = `elements`.`draftId` WHERE (`elements_sites`.`siteId`=1) AND (`elements`.`archived`=FALSE) AND (`elements`.`dateDeleted` IS NULL) AND (`elements`.`canonicalId` IS NULL) AND ((`elements`.`draftId` IS NULL) OR (`drafts`.`provisional`=FALSE)) AND ((`elements`.`draftId` IS NULL) OR (NOT (`elements`.`canonicalId` IS NULL)) OR (`drafts`.`saved`=TRUE)) AND (`elements`.`revisionId` IS NULL) ORDER BY `elements`.`id` LIMIT 100) `subquery` INNER JOIN `elements` `elements` ON `elements`.`id` = `subquery`.`elementsId` INNER JOIN `elements_sites` `elements_sites` ON `elements_sites`.`id` = `subquery`.`siteSettingsId` INNER JOIN `shopify_products` `shopify_products` ON `shopify_products`.`id` = `subquery`.`elementsId` INNER JOIN `shopify_data` `data` ON `data`.`shopifyId` = `shopify_products`.`shopifyGid` LEFT JOIN `drafts` `drafts` ON `drafts`.`id` = `elements`.`draftId` ORDER BY `elements`.`id`
`
Hi @nfourtythree, thank you and sorry the disturb! The update works well but just after i continue to have error when i try to open the shopify dashboard page