Home / Forums / WoodMart support forum / Favorites top bar issue
Home › Forums › WoodMart support forum › Favorites top bar issue
Favorites top bar issue
- This topic has 3 replies, 2 voices, and was last updated 3 months ago by
Aizaz Imtiaz Awan.
-
AuthorPosts
-
March 31, 2026 at 10:51 am #714651
JohnParticipantWhen adding something to the favorites you can see the top account heart icon to change the counter, so if you had “0” it will change to “1” or similar.
So far so good if you stay in the same browser.
When swapping browser with the same account, if you go to the favorites page you will see your favorites, but whatever you do e.g. clear caches or make refreshes it will still stay to “0”.
Am I doing something wrong ?
March 31, 2026 at 2:13 pm #714686Hello,
Please deactivate all the 3rd party plugins and activate only theme-required plugins on the site and then check the issue. I am sure your issue will be solved. Then Activate the 3rd party plugins one by one and check which plugin is creating the issue for you.
Otherwise, if the issue still exists then keep the 3rd party plugins deactivated and share the WP admin login details of your site so I will check and give you a possible solution.
Best Regards
March 31, 2026 at 3:08 pm #714692
JohnParticipantNone plugin was responsible. The issue is that you read the top bar favorite count from cookie.
If you swap browser the count is lost, because it is within the cookie.
If you add a favorite from a browser and go to another and add a favorite from there the number will become from 0->2 and that confirms it.You should have an option “Enable fragment updating” but didn’t find one in your settings.
Anyway, this PHP code fixes it:
add_action( 'template_redirect', 'woodmart_safe_sync_wishlist_cookie' ); function woodmart_safe_sync_wishlist_cookie() { if ( is_admin() || ! is_user_logged_in() ) { return; } if ( function_exists( 'woodmart_get_wishlist_count' ) ) { $count = woodmart_get_wishlist_count(); $current_cookie = isset( $_COOKIE['woodmart_wishlist_count'] ) ? intval( $_COOKIE['woodmart_wishlist_count'] ) : -1; if ( $current_cookie !== intval( $count ) ) { setcookie( 'woodmart_wishlist_count', $count, time() + 7 * DAY_IN_SECONDS, '/' ); $_COOKIE['woodmart_wishlist_count'] = $count; } } }April 1, 2026 at 7:37 am #714744Hello,
Thank you for the detailed explanation and for sharing your solution
At the moment, there is no built-in option like “Enable fragment updating” for the wishlist counter, but we appreciate you sharing this workaround — it can be helpful for similar cases.
If you notice any side effects or need further improvements, feel free to let us know.
Best Regards
-
AuthorPosts
Tagged: Favorites
- You must be logged in to create new topics. Login / Register