2015-05-27 19 views
1

我想爲Shopify製作一個模板,只有管理員才能看到。 我只能讓客戶看到它,但現在只需要管理員的代碼。模板腳本,使其僅供管理員shopify

爲我用客戶的代碼是:

{% 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 

現在是有可能使類似這樣只對管理員的東西嗎?管理實體的名稱是什麼?這裏例如實體客戶是'客戶'。我應該如何在代碼中聲明管理員? 在此先感謝。

回答

1

看到這些類似的問題:

目前有像您可以爲客戶檢查管理員沒有很好的方式。您的選擇是tag your customers as admins,並且只顯示您的模板,如果客戶有管理員標記,或check against the customer's email address來確定他們是否是管理員。

+0

It worked :) 非常感謝 –