Home › Forums › WoodMart support forum › Wishlist checkmark disappearing after page refresh › Reply To: Wishlist checkmark disappearing after page refresh
March 16, 2021 at 9:46 am
#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
}