Wishlist

This feature comes with an Element "Wishlist" that is meant to be used inside a query loop. With this you can let users save favorite posts (products).

You can control default and active icon states easily:

Creating a list of favorite posts

If user is not logged in - favorite posts are stored in a local storage. If they are logged in, favorite posts are tied to their account. Use this custom code to query them (Query editor - PHP) - in this case its for products:

Showing dynamic number indicating number of favorite posts

Sometimes we want to display this: and update the number every time post is being added to wishlist. We can use simple PHP function to retrieve this number:

Make sure that the returned element has this class: "brt-wishlist-items-count" which will update our number via AJAX.

Last updated