Menu
Feedback
Start here
Tutorials


Tutorials
Explore in-depth tutorials for operating your VTEX store.
Tutorials
Catalog
Products and SKUs
Setting up product comparison

This tutorial is only applicable to Legacy CMS Portal stores.

Product Comparison is a native VTEX feature that allows you to view the details and specifications of selected products side by side. This makes it easy to compare items and quickly identify differences between their specifications.

The configuration process involves two steps:

  • Comparison page: Where you can view a side-by-side comparison of products selected from the product listing page.
  • Product listing page: Where you can select products to compare.

Product comparison doesn't work on the store homepage.

Instructions

Follow the steps below to configure the product comparison in your store.

Comparison page

  1. Create a shelf template to standardize product display on the comparison page. In this template, you can use any of the available controls for shelves.
  2. Create a page template using the <vtex.cmc:ProductComparison/> control, which displays products side by side on the comparison page. Example usage of the control:

<vtex.cmc:ProductComparison ShelfLayoutId="12343216-4c8e-4cd5-bcd7-e3b062681f2a"/>

where ShelfLayoutId is the Id of the shelf template created in the previous step.

  1. Create a folder for the comparison page:
  • In the Admin, go to Storefront > Layout

  • In the column next to it, click CMS > Sites and channels > {website name} > / > New folder. Replace {website name} based on your scenario.

  • In the Folder Name field, enter a name for the folder and click OK.

  • Click Save Folder.

    {"base64":"  ","img":{"width":1296,"height":567,"type":"gif","mime":"image/gif","wUnits":"px","hUnits":"px","length":1053986,"url":"https://images.ctfassets.net/alneenqid6w5/7lAM8DDROFdPxQYaZoRRzk/19abe7f5f04424757f7978e6593b238d/new-folder-en.gif"}}

  1. Create a default layout:
  • Open the folder created in the previous step.

  • Click New layout.

  • In the Template field, link the page template created in step 2 to the folder. Learn more in Associating a template with a layout.

  • Click Save Layout and then click OK.

    {"base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAIAAADwyuo0AAAACXBIWXMAAAPoAAAD6AG1e1JrAAAAI0lEQVR4nGOQlJRct27t379/X758ySApKdnb0zV37tzOzg4ArO8NZv1UUNwAAAAASUVORK5CYII=","img":{"src":"https://images.ctfassets.net/alneenqid6w5/4krTQkJzqQRbgWJrtlftgJ/c8bfbb11d749e4417ef892c3ad282a99/new-layout-en.gif","width":1296,"height":567,"type":"gif"}}

Product listing page

To display products with the comparison option (checkbox), add the $product.Compare control to the shelf templates where you want to include this feature. This control will render a checkbox to select products for comparison. Additionally, the control will provide a Compare link in the header and footer of the product listing. You can click this link to be redirected to the comparison page.

You can only compare 4 products at a time.

Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Improving the performance of product images
« Previous
Adding product specifications or fields
Next »
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
On this page
Still got questions?
Ask the community
Find solutions and share ideas in the VTEX community.
Join our community
Request support from VTEX
For personalized assistance, contact our experts.
Open a support ticket
GithubDeveloper portalCommunityFeedback