How to hit a app controller while creating theme app extension

Shopify Partner
6 0 0

hey guys,i have some questions.


1) i am working with theme app extensions and i have a app, i want to know how i can hit a route inside my app for getting my custom data.


2) i want to hit a third party api directly from my block file custom.liquid using js, every time I do that it says failed to load. 

Reply 1 (1)

Shopify Partner
303 50 48

hi @nihal
You can make HTTP request to any 3rd party API from you're liquid file using the browser's native fetch API or an HTML form. Either way works. Just make sure to format the request body such that the 3rd party API that you're trying to hit can consume the data that you're sending in the request body. I recommend using fetch API for that purpose. You can also hit you're app using this method if you're app is publicly available (either hosted on the cloud or running locally with port forwarding). Just keep in you might face a CORS error while requesting to a 3rd party application from you're liquid file.


Brain Station 23 PLC
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution