Category Page Variables for Javascript

Overview

If you need to display dynamic category information or load dynamic info into javascript, You can use the Category HTML Block and accompanying variables.

Adding Code With Variables to a Category Page

Step 1: Drag the Category HTML block into your Category Template

1278

Step 2: Insert variables into your HTML or Javascript snippets.

<p>I'm Category HTML. Click here to edit my code with category details.</p>
<ul>
    <li>category id: [categoryId]</li>
    <li>category name: [categoryName]</li>
    <li>category description: [categoryDescription]</li>
    <li>category url: [categoryUrl]</li>
    <li>category image: [categoryImage]</li>
</ul>

HTML Variables

VariableDesrcriptionFormatting
'[customerId]'The ID of the customer if logged in.Int
'[customerEmail]'The email address of the customer if logged in.String
'[customerFirstName]'The first name of the customer if logged in.String
'[customerLastName]'The last name of the customer if logged in.String
'[cartId]'The ID of the current cart if there are items or if the customer is logged in.Int