javascript - Shopify Theme App Extension - Fetch Data from my Apps API
Solution:
You cannot call your App from an extension as the extension has no context about your App. It is just, front-end code, so that means of course you get CORS errors. Your app is a different domain. And even if you could CORS in you could not access your App securely for obvious reasons.
So in your extension, make your App calls using a Proxy URL from the App Proxy you setup in your App. That way, your extension is securely able to call your App and return either Liquid or JSON as you wish. That is the way to go.
Source
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.