A space to discuss online store customization, theme development, and Liquid templating.
Hi all,
Building an app where I want to load a modal on a customers Shopify site. However, to do so I need to be able to fire an AJAX call to the app to get the relevant information to populate the modal.
As the domain is external to Shopify, there is the CORS issue.
I've tried searching for a solution but it does not seem readily available. What's the best way to approach this?
Finally, someone else is on the same issue. We're all brothers in arms here. For some reason, almost as if by design, Shopify support/admins on here will never give you a straight answer.
I'm looking for the same thing too. Last I've read on here, you have to "What you can do is from your front end, delegate to your backend to make the request, and return the response data from that request to your front end." Unfortunately, that's very vague. They're probably just going to tell you to hire an expert, and not answer the issue publicly.
Yeah, there seem to be some "ways" floating about such as using JSONP but they don't seem like a solution but more a "hack" to get it to work for cross-browser requests.
App Proxy seems another way but is aimed towards render pages with custom content rather than serving content from Javascript using API requests.
Apps out there have done this look at Privy, Ultimate Special Offers etc they all have on-page modals and such which require talking to their app from another domain. It's just not well documented seen as it's meant to be a big thing the Script Tag.