Solved

How to create the cartTransform object without using GraphiQl app?

Itachi_Uchiha
Shopify Partner
12 0 0

After implementing and deploying the Cart Transform function extension to the store, the next step is to create a cartTransform object to activate the function. To do that if try to run the cartTransformCreate mutation using the access_token that I obtained by creating an app from "settings > Apps and sales channels > Develop Apps > API credentials" section I get "function not found" error.  


While the documentation always refers to using the GraphiQl app for every function activation(Ex: 1, 2), there is a need to clarify which access token to use and how to obtain it when activating the function directly from the code.

So, my question is when activating it from my code which access token to use and how do I get that? 

Really stuck here and any help will be greatly appreciated.

Thanks! 

Accepted Solution (1)

Nick_Wesselman
Shopify Staff
141 34 51

This is an accepted solution.

Hi @Itachi_Uchiha. You are correct that the API credentials from your shop won't work -- functions can only be used by access tokens from the same app that contains them. You would need to make the API request from an embedded app, such as a Remix app. The Remix app template documentation has an example of making a GraphQL call to the Admin API:

https://shopify.dev/docs/api/shopify-app-remix/v2/apis/admin-api#example-graphql

 

-Nick

Nick Wesselman | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

View solution in original post

Replies 2 (2)

Nick_Wesselman
Shopify Staff
141 34 51

This is an accepted solution.

Hi @Itachi_Uchiha. You are correct that the API credentials from your shop won't work -- functions can only be used by access tokens from the same app that contains them. You would need to make the API request from an embedded app, such as a Remix app. The Remix app template documentation has an example of making a GraphQL call to the Admin API:

https://shopify.dev/docs/api/shopify-app-remix/v2/apis/admin-api#example-graphql

 

-Nick

Nick Wesselman | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Itachi_Uchiha
Shopify Partner
12 0 0

Thanks @Nick_Wesselman. Specially for the link. I wouldn't have found it easily.