• Hello, i would like to add wishlist item on my nav menu (made with elementor), maybe with a counter, how can i do it? I have the free version

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi there

    Maybe you could consider upgrading, to have a dedicated “Mini Wishlist” widget, to use in your header
    You can read more about this feature on plugin landing page, on our site

    Otherwise, I could help you get the number of items in wishlist via code, or I could guide you in creating a shortcode that prints just an heart and the count, so that you could place it wherever you want

    Please, let me know

    Thread Starter deny21

    (@deny21)

    If you can help me with the shortcode i would be grateful

    Plugin Author YITHEMES

    (@yithemes)

    Hi there

    The following code will define the shortcode yith_wcwl_items_count, that will just contain an heart icon (if your theme doesn’t forcefully remove FontAwesome) and count of items in wishlist

    if ( function_exists( 'YITH_WCWL' ) ) {
    	if ( ! function_exists( 'yith_wcwl_add_counter_shortcode' )  ) {
    		function yith_wcwl_add_counter_shortcode() {
    			add_shortcode( 'yith_wcwl_items_count', 'yith_wcwl_print_counter_shortcode' );
    		}
    	}
    
    	if ( ! function_exists( 'yith_wcwl_print_counter_shortcode' )  ) {
    		function yith_wcwl_print_counter_shortcode() {
    			?>
    			<div class="yith-wcwl-counter">
    				<i class="yith-wcwl-icon fa fa-heart"></i>
    				<span class="count"><?php echo esc_html( yith_wcwl_count_all_products() ); ?></span>
    			</div>
    			<?php
    		}
    	}
    	add_action( 'init', 'yith_wcwl_add_counter_shortcode' );
    }
    

    You can use it wherever you can add and render shortcode, and apply style or change HTML structure in the code that I provided, to customize its appearance

    Thread Starter deny21

    (@deny21)

    I have Astra theme, i add the shortcode in elementor header, but it doesn’t work.

    Plugin Author YITHEMES

    (@yithemes)

    @deny21 You’ll need to be more specific on the problem you’re facing
    Is the shortcode replaced or do you see just the tag you entered?

    In this last case, the problem is that, wherever you entered the tag, you’re missing a do_shortocode() to execute any shortcode

    If the shortcode is replaced instead, I’d like to understand what do you see, and what is the issue you’re facing

    @yithemes Perfect! Work like a charm!!! Thanks for the Code!

    Plugin Author YITHEMES

    (@yithemes)

    @ahmadjan You’re welcome

    We are doing our best to improve our plugins. Our target is to develop and release the best free plugins for WooCommerce, but to achieve this we need your help. Please leave a good review to support us and help our growth ??

    sorry , where am I going to put that long code, is it on the function.php or header.php, i have the same problem but i want the counter on a button or icon which are located on my header

    Hi, I have added the code mentioned above in the nav menu as a html element:

    <div class=”yith-wcwl-counter”><i class=”yith-wcwl-icon fa fa-heart”></i>
    <!–?php echo esc_html( yith_wcwl_count_all_products() ); ?–></div>

    However, I only see the heart icon in the nav menu but it does not change when adding items to the wishlist, neither has the link to the wishlist page.

    What should I do next? Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add Menu item with counter’ is closed to new replies.