Product Page Variables for Javascript

Overview

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

Adding Code With Variables to a Category Page

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

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

<p>I'm Product HTML. Click here to edit my code with product details.</p>
<ul>
    <li>product id: [productId]</li>
    <li>product sku: [productSku]</li>
    <li>product name: [productName]</li>
    <li>product description: [productDescription]</li>
    <li>product price: [productPrice]</li>
    <li>product qty: [productQty]</li>
    <li>product url: [productUrl]</li>
    <li>product image: [productImage]</li>
</ul>

HTML Variables

Variable

Desrcription

Formatting

'[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