Requesting API outside call

Hi,

I’m not sure if this is the right approach but here’s what I’m trying to do:

  1. I created a shopify app with App Embed that uses js file to load and trigger a button

  2. this button shows up in the product page

  3. when the button is triggered, I want to fetch the product information using product ID

I know that using

await authenticate.admin(request);

inside the app is not a problem, but how can I call the api in the store front using js to return product data?

Thanks in advance!

See shopify.dev

For front facing product data like product name use the storefront api.

For backend data like cogs etc you’d have to proxy the admin api through your app, or make an app-proxy.

If you have the product handle use the ajax api.