How to get Script Tag to render?

PTP
Shopify Partner
14 0 2

I'm trying to get a test-script to load on my development shopify store using GraphQL (Graphiql test app). The Script Tag is successfully created. However, the `test-script`, which should be injected into the shopify store, does not display. I believe the issue stems from my misunderstanding of the ScriptTagInput.src field from the GraphQL docs.

I'm not sure where to place the test-script.js file in order to access it as a URL in the mutation.

test-script.js

console.log('this is coming from the test script api');

GraphQL Mutation:

mutation scriptTagCreate($input: ScriptTagInput!) {
    scriptTagCreate(input: $input) {
      scriptTag {
        id
      }
      userErrors {
        field
        message
      }
    }
  }


{
  "input": {
    "src": "https://d74c-12-216-7-134.ngrok.io/test-script.js",
    "displayScope": "ALL"
  }
}

Current File Structure:

Screen Shot 2021-12-16 at 5.19.02 PM.png

 

 

This is the repo I cloned using the Shopify CLI. It has removed the use of Next.js.

How do I get the test-script.js script URL so that I can have it loaded in my Shopify development store?

Replies 0 (0)