• Good afternoon, I am using a shortcode to display the wishlist counter, but the link leads to the wishlist in my personal account. I would like to receive a link to the Wishlist page, with multiple languages used on the site. How can this be done?
    I attach the code:

    if ( defined( 'YITH_WCWL' ) && ! function_exists( 'yith_wcwl_get_items_count' ) ) {
      function yith_wcwl_get_items_count() {
        ob_start();
    	
        ?>
    	<a href="<?php echo esc_url( YITH_WCWL()->get_wishlist_url() ); ?>" name="" aria-label="<img alt=&quot;Wishlist&quot; src=&quot;https://webproff.eu/anix-new/wp-content/uploads/2023/06/heart.svg&quot; /> " class="wishlist_products_counter top_wishlist-custom top_wishlist-">
    		<span class="wishlist_products_counter_text">
    			<img alt="Wishlist" src="https://webproff.eu/anix-new/wp-content/uploads/2023/06/heart.svg"> 
    		</span>
    		<span class="wishlist_products_counter_number"><?php echo esc_html( yith_wcwl_count_all_products() ); ?></span>
    	</a>
        <?php
        return ob_get_clean();
      }
    
      add_shortcode( 'yith_wcwl_items_count', 'yith_wcwl_get_items_count' );
    }

    P.S. Happy New Year!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support Juan Coronel

    (@juaancmendez)

    Hi there,
    we hope you’re doing well and happy new year to you too!

    In order to change the wishlist URL in the wishlist counter, add the following code in the functions.php file of your active child theme:

    if (!function_exists('yith_wcwl_change_wishlist_url_counter')) {
        function yith_wcwl_change_wishlist_url_counter() {
            $jquery = '
                jQuery( document ).ready(function($){
                    $( ".wishlist_products_counter" ).attr( "href", "https://yourcustomlink" );
                });';
            wp_add_inline_script('woocommerce', $jquery);
           
        }    
       add_action( 'wp_enqueue_scripts', 'yith_wcwl_change_wishlist_url_counter', 999 );
    }

    Simply you can change the text “https://yourcustomlink” with the URL you want.

    Check it out and tell us if it works well for you, please.

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Get link to wishlist Good afternoon, I am using a shortcode to display the wish’ is closed to new replies.