• Hello, How can I add the heart icon that redirects me to wishlist page in header using Elementor?

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

    (@juaancmendez)

    Hello there,
    we hope you’re doing well!

    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.

    Wherever you want to execute it, you must use do_shortcode().

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

    Have a nice day!

Viewing 1 replies (of 1 total)
  • The topic ‘Add wishlist heart icon to header using Elementor’ is closed to new replies.