Wish List
Last updated
Last updated
📢 Use this project, contribute to it or open issues to help evolve it using Store Discussion.
Designed for B2C stores, the Wishlist app adds a heart icon to digital shelves and product details pages, allowing users to add their desired products to a wishlist.
Example of heart icons on a shelf.
Example of a heart icon on a product details page.
In addition, it generates a brand-new route called /wishlist
under the My Account menu, creating a page with the items users added to the wishlist.
Example of a wishlist page.
Install the Wishlist app in the desired VTEX account by running vtex install vtex.wish-list
in your terminal.
Open your Store Theme app directory in the code editor.
Add the Wishlist app to your theme's manifest.json
file inside peerDependencies as shown below:
ℹ️ The Wishlist app can export two theme blocks when added as a dependency:
add-to-list-btn
andlist-context.wishlist
. These are responsible for adding the heart icon to other theme blocks and providing product data to build the/wishlist
, which is also shared with the My Account page.
Add the add-to-list-btn
block in the store.product
template's children block list. For example:
Declare the add-to-list-btn
block as a child of the product-summary.shelf
blocks in your theme. For example:
ℹ️ The new route called
/wishlist
, which creates the Wishlist custom page containing the products added to the wishlist, already has a default template and is rendered under the My Account menu. No further action is required. However, you can customize the Wishlist page by overwriting the template. To do so, you have to create a brand new one as you wish. See more details in the Advanced configurations section below.
The Wishlist app architecture allows you to customize the /wishlist
page using other blocks. Currently, its default implementation is as follows:
store.wishlist
interface for the route /wishlist
and my-account-page.wishlist-page
along with my-account-link.wishlist-link
for the Wishlist section under My Account.
wishlist.jsonc
Add the plugins.json
file to your theme's /store/
folder. This will add the Wishlist to My Account.
plugins.json
By "default implementation" we mean that, by installing the Wishlist app in your store, you're using the json
above behind the scenes to build the new page template (/wishlist
), as shown in the third image displayed above.
Therefore, to customize the /wishlist
page configuration, you need to:
Create a wishlist.jsonc
file under store/blocks
.
Create a plugins.json
file under store/
.
Copy the code above, paste it in the new file, and change it as you wish.
Deploy your changes.
If you want to configure the layout without the slider-layout
dependency, you can use the list-context-renderer
to wrap the product-summary.shelf
. Learn more here.
my-account-link.wishlist-link
props
label
string
Changes the section menu label on the My Account page
Wishlist
There are a couple of URLs to read, search and change data for the app:
To read the schema of the Wishlist app:
To GET all the wishlist data:
To search for a wishlist by user email:
To PATCH a wishlist to Master Data:
To DELETE a wishlist from Master Data:
To change the link of the toast message:
toastURL
string
Changes the link of the toast message
/account/#wishlist'
To show a custom view if no product has been added to the wishlist:
list-context.wishlist
props
showViewEmptyList
boolean
Shows a custom view if no product has been added to the wishlist
false
To apply CSS customizations to this and other blocks, follow the instructions in Using CSS handles for store customization.
columnText
columnThumb
linkText
linkThumb
listItemsContainer
listName
listTab
productDescription
productItemRow
productTitle
thumb
wishlistContainer
wishlistIcon
wishlistIconContainer
emptyMessage
Thanks goes to these wonderful people:
This project follows the all-contributors specification. Contributions of any kind are welcome!