Home › Forums › WoodMart support forum › Wishlist checkmark disappearing after page refresh
Wishlist checkmark disappearing after page refresh
- This topic has 13 replies, 2 voices, and was last updated 3 years, 8 months ago by Artem Temos.
-
AuthorPosts
-
March 16, 2021 at 7:33 am #273784
bogdan-mihaiParticipantHello!
We are experiencing an issue with the wishlist functionality. Everything works fine until a point:
– clicking the heart button adds the product to the wishlist
– the heart transforms into a checkmark
– clicking the checkmark sends to the Wishlist page and products are being shownHowever, if the page from where you added the product to the wishlist is refreshed or you move to another page and you then come back to the page – the checkmark is again a heart and you have the option to add the product to the wishlist again.
Everything else still works – the wishlist contains the products already added, but the checkmark always disappears.
What could cause this and how can we fix it? Can it be related to caching?
Thank you and all the best,
Bogdan MihaiMarch 16, 2021 at 7:58 am #273796
Artem TemosKeymasterHello,
Yes, it is how the “Add to wishlist” button works. It doesn’t “remember” that you added this product to the list already. Even we add this functionality, it will never work because of cache plugins that are used on 95% of websites.
Kind Regards
March 16, 2021 at 8:23 am #273801
bogdan-mihaiParticipantHi Artem,
Thank you for your answer.
Couldn’t this be added as a caching exceptions?
For us this is quite a big issue as the client expects this to work by remembering what products were added to the wishlist – we didn’t notice this until now as for us it was expected behavior as well. I think that most websites that offer the wishlist functionality also have the remember functionality.
What would be a solution for this? Say we are not using a caching plugin, how could we implement this then?
All the best,
BogdanMarch 16, 2021 at 8:33 am #273803
Artem TemosKeymasterHello,
It is not possible to exclude only a part of the page in the cache plugin. We will consider implementing this function for those who don’t use the cache plugin in our future updates.
Unfortunately, there is no quick workaround for this.Kind Regards
March 16, 2021 at 8:48 am #273811
bogdan-mihaiParticipantHi Artem,
Well, it is possible to exclude scripts used on a page from the cache.
And I’m afraid I will have to push on this, as again it is quite a big issue for us. There was no indication that the wishlist icon will reset after page refresh.
We did test the theme before buying it, to see how everything works. We didn’t notice this because it is something that is expected behavior on every website with a wishlist functionality. All the websites we checked have this and we have other WordPress themes where this is an option by default.
We are now in an advanced phase of the project where we can’t just tell the client that this is not a feature offered by the theme.
So again I will have to ask you to assist us with finding a solution to this.
Thank you and all the best,
BogdanMarch 16, 2021 at 9:46 am #273828
Artem TemosKeymasterTry to edit the file
woodmart/inc/integrations/woocommerce/modules/wishlist/class-ui.php
and replace the wholeadd_to_wishlist_btn
function code with the following http://prntscr.com/10n3rlwpublic function add_to_wishlist_btn( $classes = '' ) { woodmart_enqueue_js_script( 'wishlist' ); $added = false; $link_classes = ''; $text = esc_html__( 'Add to wishlist', 'woodmart' ); if ( $this->wishlist && $this->wishlist->get_all() ) { $products = $this->wishlist->get_all(); foreach ( $products as $product ) { if ( (int) get_the_ID() === (int) $product['product_id'] ) { $added = true; } } } if ( $added ) { $link_classes .= ' added'; $text = esc_html__( 'Browse Wishlist', 'woodmart' ); } ?> <div class="wd-wishlist-btn <?php echo esc_attr( $classes ); ?>"> <a class="<?php echo esc_attr( $link_classes ); ?>" href="<?php echo esc_url( woodmart_get_whishlist_page_url() ); ?>" data-key="<?php echo esc_attr( wp_create_nonce( 'woodmart-wishlist-add' ) ); ?>" data-product-id="<?php echo esc_attr( get_the_ID() ); ?>" data-added-text="<?php esc_html_e( 'Browse Wishlist', 'woodmart' ); ?>"><?php echo esc_html( $text ); ?></a> </div> <?php }
March 16, 2021 at 3:42 pm #274022
bogdan-mihaiParticipantHi again Artem,
Thank you for your help with this!
I have replaced the code with the one you provided, but it seems to break the site.
I will send you both a WordPress user and a FTP user, so that you can look directly on a testing environment, in case I’m doing something wrong or it’s something to do with our setup.
All the best,
BogdanMarch 17, 2021 at 9:55 am #274223
Artem TemosKeymasterHello,
Please, check how it works on your side now.
Kind Regards
March 17, 2021 at 10:07 am #274231
bogdan-mihaiParticipantHi Artem,
Yes, it seems to be working now. We continue to test to see if everything goes well.
Can you please let me know the steps you took to implement, so that we can recreate it?
Thank you very much for your help,
BogdanMarch 17, 2021 at 10:13 am #274234
Artem TemosKeymasterHello,
We are going to add this option in our update so you don’t need to do anything in the future.
Kind Regards
March 17, 2021 at 10:21 am #274236
bogdan-mihaiParticipantThat’s great, thanks!
Do you have an estimate on when the update will be available?
As it might make sense for us to wait for the update, than to recreate the changes you made on the live site – the changes you made where on a testing environment.
March 17, 2021 at 12:06 pm #274289
Artem TemosKeymasterWe are going to release an update in 2-3 weeks.
March 17, 2021 at 1:55 pm #274349
bogdan-mihaiParticipantGreat, thank you very much for your help!
Keep up the good work,
BogdanMarch 17, 2021 at 2:24 pm #274360
Artem TemosKeymasterThank you! Feel free to contact us if you have any extra questions.
-
AuthorPosts
Tagged: checkmark, disappears, error, wishlist
The topic ‘Wishlist checkmark disappearing after page refresh’ is closed to new replies.
- You must be logged in to create new topics. Login / Register