Add to Favorites
Updated 4 days ago
Every Zephyr site visitor can create their own list of favorite items (wishlist) via the "Add to Favorites" Button element.
This element works for all post types (posts, pages, products), including custom.
How it works:
The first click on the "Add to Favorites" button saves the current item in the favorites list; the second click will delete the current item from the favorites list.
If a user is logged in, then their favorites are stored in a user-specific custom field us_favorite_post_ids
and are saved to the database for an unlimited period of time. Thus, returning visitors will see their favorites when they log back in.
If a user is not logged in, the information about the products marked as favorites is stored in a specific cookie, with an expiration period of one year (365 days).
Saved favorite items can be shown via the Post List and Product List elements. Learn how.
Currently, the "Add to Favorites" Button element doesn't take into account cached pages, so it's recommended to disable HTML caching for logged-in users.
"Add to Favorites" Button on product pages #
Open the template you use for the product page at Templates > Page Templates and include the Add to Favorites Button element.
"Add to Favorites" Button in the Grid Layout #
Open the Grid Layout you use for the list(s) of products at Templates > Grid Layouts and include the Add to Favorites Button element.
"Add to Favorites" Button Customization #
Element settings allow you to customize the button style, show or hide the favorites icon, specify labels for different button states, and customize the message after adding.
How to Show Favorite Items #
Add a Post List or Product List element and set it up to Show > Favorites of the current user.
Every user can see only their own favorite items.
Unregistered users will always see the "No results found" state of the list element.
Favorites Counter in the Header #
While editing the header, you can add the Favorites Counter element, which shows the number of products added to favorites and redirects visitors to the favorites list when clicking (you should set the link manually).
Use relevant settings to customize the icon and the quantity badge's colors, specify the URL of the favorites list, and set up the element to remain hidden if the favorites list is empty.