Hello,
Sorry, found one more bug on Easystore, and this one is pretty annoying as I couldn't directly find an easy workaround (apart from modifying Easystore code, which I want to avoid).
Adding a product to the wishlist works fine, but when going to the wishlist itself, the add-on still displays the button as “Add to wishlist” and clicking it does not remove the product from the wishlist as expected.
In wishlist.site.js, the addToWishList() method determines whether the action should be add or remove based on whether the button has the .active class. On the wishlist page, the button does not seem to receive the proper active state even though isWishlist is correctly set to true.
Example rendered button:
<button
type="button"
x-data="easyStoreWishlist"
@click="addToWishList({
productId: 31,
hasText: true,
hasIcon: false,
isWishlist: true
})"
class="btn btn-outline-secondary easystore-btn-add-to-wishlist"
>
<span class="easystore-btn-text">
Add to wishlist
</span>
</button>
It seems that when the addon is used with the wishlist source, EasyStore should automatically render the wishlist button in its active/remove state instead of relying only on the .active class detection.
Could you please check whether this is a bug in the SP Page Builder wishlist addon or in the addtowishlist.php layout / wishlist.site.js logic?
Ideally, when isWishlist is true:
- the button should display “Remove from wishlist”;
- the button should already be in the active state;
- clicking it should call the remove action;
- and the wishlist page should refresh after the item is removed.
Btw, it seems there is also some bug in the page refresh after clicking this button... It looks like it refreshes immediately, without leaving the JS enough time to execute its action, as the action is not synchronous.
Could you please correct that in next Easystore version.
Thanks a lot