Javascript 模板脚本,使其仅对shopify上的管理员可见
我想让shopify上的模板只对管理员可见。 我可以让它只对客户可见,但现在只需要一个管理员代码 我使用的客户代码是:Javascript 模板脚本,使其仅对shopify上的管理员可见,javascript,php,web-applications,shopify,Javascript,Php,Web Applications,Shopify,我想让shopify上的模板只对管理员可见。 我可以让它只对客户可见,但现在只需要一个管理员代码 我使用的客户代码是: {% unless customer %} {% if template contains 'customer' %} {% assign send_to_login = false %} {% else %} {% assign send_to_login = true %} {% endif %} {% endunle
{% unless customer %}
{% if template contains 'customer' %}
{% assign send_to_login = false %}
{% else %}
{% assign send_to_login = true %}
{% endif %}
{% endunless %}
{% if send_to_login %}
<meta content="0; url=/account/login?checkout_url={{ shop.url }}" http-equiv="refresh" />
{% else %}
==== Page Content ===
{% endif %}
//The code above asks to the user to login if they visit this template
现在有可能只为管理员制作类似的东西吗?管理实体的名称是什么?例如,这里的实体客户是“客户”。我应该如何在代码中声明管理员?
提前谢谢 看看这些类似的问题: 目前还没有像为客户检查管理员那样好的方法。您的选项是,并且仅当客户具有管理员标签时才显示您的模板,或者确定他们是否是管理员