
Shopify
Getting Shopify Functions to work
Recently I was trying to deploy a Shopify function but could not get it to work in production. This was after using shopify app deploy successfully and seeing my latest POS tiles update on my test device.
Here is what I discovered through the help of a wonderful coworker of mine. First, you have to get your function ID. I ran this using the official Shopify Graphiql App
graphql
1query {
2 shopifyFunctions(first: 25) {
3 nodes {
4 app {
5 title
6 }
7 apiType
8 title
9 id
10 }
11 }
12}Then you have to activate the function using a mutation like this. In my case, I was deploying a cart transform function
graphql
1mutation {
2 cartTransformCreate(functionId: "YOUR_FUNCTION_ID_HERE") {
3 cartTransform {
4 id
5 functionId
6 }
7 userErrors {
8 field
9 message
10 }
11 }
12}This will activate your function on the store