Check if current customer is an admin in Shopify?

不想你离开。 提交于 2019-12-12 01:57:50

问题


I would like to add a conditional on some pages in my Shopify theme that displays more info if the user viewing the page is an admin (and is logged in). Is there a way to do this? The obvious way is to check the customer.email property against some hard-coded values that belong to admins. But that's a maintenance headache and a poor design. Is there a better way?

Thanks.


回答1:


There is no list of Shop accounts available to check against. The only check you could make against is the shop email address or the shop customer_email and that is kinda loser-ish.

You're in tough on this one as Shopify does not yet provide any Shop accounts. Even the embedded SDK's for POS and WWW provide nothing more than "this user is an admin, or this user is a staff account", but no identifying data.



来源:https://stackoverflow.com/questions/27177919/check-if-current-customer-is-an-admin-in-shopify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!