This page is about version 1.2.0 of the app, which is not the most recent version. The latest stable version is 1.17.0.
The Wishlist app, designed for B2C stores, adds a heart icon to shelves and product detail pages, so users can add the desired products to a Wishlist.
In addition to that, a brand new route called /wishlist
is generated under the My Account menu, creating a page responsible for listing all wishlisted items for your users.
Configuration
- Install the Wishlist app in the desired VTEX account by running
vtex install vtex.wish-list
in your terminal. - Open your store's Store Theme app directory in your code editor.
- Add the Wishlist app to your theme's
manifest.json
file inside peerDependencies as shown below:
_10 "peerDependencies": {_10+ "vtex.wish-list": "1.x"_10 }
The Wishlist app can export two theme blocks when added as a dependency:
add-to-list-btn
andlist-context.wishlist
. They are responsible, respectively, for adding the heart icon to other theme blocks and for providing product data to build the/wishlist
page.
- Add the
add-to-list-btn
block into thestore.product
template's children block list. For example:
_10{_10 "store.product": {_10 "children": [_10 "product-name",_10 "product-reviews",_10+ "add-to-list-btn"_10 ]_10 },
- Declare the
add-to-list-btn
block as a child of theproduct-summary.shelf
blocks in your theme. For example:
_10 "product-summary.shelf": {_10 "children": [_10+ "add-to-list-btn",_10 "product-summary-name",_10 "product-rating-inline",_10 "product-summary-price",_10 "add-to-cart-button"_10 ]_10 }
The new route called
/wishlist
, responsible for creating the Wishlist custom page that displays wishlisted product items, already contains a default template, meaning it is ready to be rendered under the My Account menu and no further actions are required from you. However, you can customize the Wishlist page, overwriting the template by creating a brand new one as you wish. To do so, check the Advanced configurations section below.
Advanced configurations
According to the Wishlist app composition, the /wishlist
page can be highly customizable using other blocks. Currently, its default implementation is as follows:
_61{_61 "my-account-page.wishlist-page": {_61 "blocks": [_61 "flex-layout.row#top",_61 "list-context.wishlist"_61 ]_61 },_61 "store.wishlist": {_61 "blocks": [_61 "flex-layout.row#top",_61 "list-context.wishlist"_61 ]_61 },_61 "flex-layout.row#top": {_61 "children": [_61 "flex-layout.col#title"_61 ]_61 },_61 "flex-layout.col#title": {_61 "children": [_61 "rich-text#title"_61 ],_61 "props": {_61 "blockClass": "titleWishlist",_61 "preventVerticalStretch": true_61 }_61 },_61 "rich-text#title":{_61 "props": {_61 "text": "### Wishlist"_61 }_61 },_61 "list-context.wishlist": {_61 "blocks": ["product-summary.shelf#wishlist"],_61 "children": ["slider-layout#wishlist"]_61 },_61 "product-summary.shelf#wishlist": {_61 "children": [_61 "add-to-list-btn",_61 "product-summary-image",_61 "product-summary-name",_61 "product-summary-space",_61 "product-summary-price",_61 "add-to-cart-button"_61 ]_61 },_61 "slider-layout#wishlist": {_61 "props": {_61 "itemsPerPage": {_61 "desktop": 5,_61 "tablet": 3,_61 "phone": 1_61 },_61 "showNavigationArrows": "desktopOnly",_61 "showPaginationDots":"always",_61 "infinite": false,_61 "fullWidth": true,_61 "blockClass": "shelf"_61 }_61 }_61}
By default implementation we mean that by installing the Wishlist app in your store you're actually using the json
above behind the scenes to build the new page template (/wishlist
), as shown in the third image displayed above.
Therefore, in order to customize the /wishlist
page configuration, you should:
- Create a
wishlist.jsonc
file understore/blocks
. - Copy the code above, paste it in the new file and change it as you wish.
- Deploy your changes.
Customization
In order to apply CSS customizations to this and other blocks, follow the instructions given in the recipe on Using CSS Handles for store customization.
CSS Handles |
---|
columnText |
columnThumb |
linkText |
linkThumb |
listItemsContainer |
listName |
listTab |
productDescription |
productItemRow |
productTitle |
thumb |
wishlistContainer |
wishlistIcon |
wishlistIconContainer |