Home Forums WoodMart support forum Wishlist checkmark disappearing after page refresh

Wishlist checkmark disappearing after page refresh

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #273784

    bogdan-mihai
    Participant

    Hello!

    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 shown

    However, 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 Mihai

    #273796

    Artem Temos
    Keymaster

    Hello,

    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

    #273801

    bogdan-mihai
    Participant

    Hi 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,
    Bogdan

    #273803

    Artem Temos
    Keymaster

    Hello,

    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

    #273811

    bogdan-mihai
    Participant

    Hi 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,
    Bogdan

    #273828

    Artem Temos
    Keymaster

    Try to edit the file woodmart/inc/integrations/woocommerce/modules/wishlist/class-ui.php and replace the whole add_to_wishlist_btn function code with the following http://prntscr.com/10n3rlw

    public 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
    }
    #274022

    bogdan-mihai
    Participant

    Hi 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,
    Bogdan

    #274223

    Artem Temos
    Keymaster

    Hello,

    Please, check how it works on your side now.

    Kind Regards

    #274231

    bogdan-mihai
    Participant

    Hi 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,
    Bogdan

    #274234

    Artem Temos
    Keymaster

    Hello,

    We are going to add this option in our update so you don’t need to do anything in the future.

    Kind Regards

    #274236

    bogdan-mihai
    Participant

    That’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.

    #274289

    Artem Temos
    Keymaster

    We are going to release an update in 2-3 weeks.

    #274349

    bogdan-mihai
    Participant

    Great, thank you very much for your help!

    Keep up the good work,
    Bogdan

    #274360

    Artem Temos
    Keymaster

    Thank you! Feel free to contact us if you have any extra questions.

Viewing 14 posts - 1 through 14 (of 14 total)

The topic ‘Wishlist checkmark disappearing after page refresh’ is closed to new replies.