Token Support in Editable Content

Go to your Storefront Dashboard > Content Management > Editable Content. 

Here you will see a list of all your Editable Content.

If you click on Edit you will be able to use the localisation tokens and localise text to make the Editable Content reusable. This is very useful when you want to avoid duplicating strings for different languages. For more information on Language Strings see Changing Storefront Text - Language Strings. 


Localisation Tokens

The token format is:

  • %Loc.Res:LanguageResourceKey%     example:       %Loc.Res:Account.Avatar% 


You are hardcoding the top menu, and have UK and US customers. In the UK, the word 'Basket' would be used, in the US, the word 'Cart' would be used. You can have one line of code that pulls the language string for basket in your header. You first need to create your language string that you will reference in your HTML. 


1. Navigate to Configuration > Languages. Press view string resources against English (or whichever language you desire)

2. Press add new record (be sure that the target language and source language match!)

3. Now, add in your new language string. We named ours Header.BasketText, and gave it a value of Cart for English US. 


4. Do the same for English UK, but this time changing the value to Basket.



5. In your HTML in Editable Content or Content Templates, you will need to insert your language string. You will want to insert it with the Localization identifier like this:


6. Next, insert this where the name Basket or Cart would appear. 

<a class="navbar-item" href="%Account.BasketUrl%">
               %Loc.Res:Header.BasketText% (%Account.BasketQuantity%)


For clarification, the token %Account.BasketUrl% is the URL to the Basket or Cart, %Loc.Res:Header.BasketText% is the string you made with the ability to change from UK and US, and %Account.BasketQuantity% is the amount of products in the Basket or Cart. 


Save, and clear the cache. 


On the frontend, if your language is US English, you will see this:


If the language is UK English, you will see this:




Account Tokens

Access Account Details via Account Tokens, plus additional tokens to control the access or show/hide elements:

  • %Account.LoginLogoutLink%
  • %Account.LoginUrl%
  • %Account.LogoutUrl%
  • %Account.BasketLink%
  • %Account.BasketUrl%
  • %Account.BasketQuantity%
  • %Account.MyAccountUrl%
  • %Account.WorkInProgressUrl%
  • %Account.ApprovalUrl%
  • %Account.ApprovalHistoryUrl%
  • %Account.HideShowClass.IfGuest%
  • %Account.HideShowClass.IfAuthenticated%
  • %Account.HideShowClass.IfCustomerImpersonated%
  • %Account.HideShowClass.IfShoppingCartEnabled%
  • %Account.HideShowClass.IfAdmin%
  • %Account.HideShowClass.Approval%
  • %Account.HideShowClass.ApprovalHistory%
  • %Account.HideShowClass.WorkInProgress%
  • %Account.ToggleClass.IfAuthenticated%
  • %Account.ToggleClass.IfCustomerImpersonated%
  • %Account.ToggleClass.IfShoppingCartEnabled%
  • %Account.ToggleClass.IfAdmin%
  • %Account.IsActiveClassApproval%
  • %Account.IsActiveClassApprovalHistory%
  • %Account.IsActiveClassWorkInProgress%

Customer Tokens

Access Customer Details via Customer Tokens, plus additional tokens to control the access and show/hide classes. Tokens will be populated with data only for authenticated customers:

  • %Customer.AccountActivationURL%
  • %Customer.Address1%
  • %Customer.Address2%
  • %Customer.CompanyName%
  • %Customer.Custom1%
  • %Customer.Custom2%
  • %Customer.Custom3%
  • %Customer.Email%
  • %Customer.ExternalID%
  • %Customer.Fax%
  • %Customer.FullName%
  • %Customer.PasswordRecoveryURL%
  • %Customer.Phone%
  • %Customer.PostCode%
  • %Customer.Username%
  • %Customer.VatNumber%
  • %Customer.VatNumberStatus%
  • %Customer.Title%
  • %Customer.StateProvince%
  • %Customer.Country%
  • %Customer.Gender%
  • %Customer.DateOfBirth%

Store Tokens

Access store general information:

  • %Store.Email%
  • %Store.Name%
  • %Store.URL%

Common Tokens

  • %Common.CurrentYear%


Have more questions? Submit a request


Please sign in to leave a comment.