Access admin API from storefront

Solved
New Member
13 0 0

Hey guys,

I am wondering if it is possible to access admin API from storefront?

I am building an app that needs to create a coupon code automatically based on a value set to every customer.

I am using JavaScript and PHP.

Thanks

0 Likes
Highlighted

Success.

Shopify Staff
Shopify Staff
1555 80 255

I'm pretty sure it's possible, but I don't think you should if you plan to do so directly. I can't think of any ways you would do this without exposing your access token in the DOM, which is ill advised. Your interface on the storefront should delegate to your back end by making an ajax call back to your app, which will make the admin API request.

 

Cheers.

0 Likes
Highlighted
New Member
13 0 0

Hi Alex I apologise for late response.

That is exactly what I ended up doing.

I created an AJAX call to my apps files and from there I created a shopify call using the API.

That worked like a charm.

Thank you for your response.

 

0 Likes