• Resolved nikketrikke

    (@nikketrikke)


    i’m using now a menu custom link but there is no count and the icon is small…
    i try some of your suggestions in various topics but not work for me
    or better some work.. css+function code + shortcake but
    not link the heart to the wishlist page
    used

    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' );
    }

    and css
    .yith-wcwl-counter {
    margin-right: -40px;
    line-height: 74px;
    }

    and finally shortcake in header using html filed
    [yith_wcwl_items_count]

    thanks

    • This topic was modified 3 years, 1 month ago by nikketrikke.

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

Viewing 1 replies (of 1 total)
  • Thread Starter nikketrikke

    (@nikketrikke)

    if ( defined( ‘YITH_WCWL’ ) && ! function_exists( ‘yith_wcwl_ajax_update_count’ ) ) {
    function yith_wcwl_ajax_update_count() {
    wp_send_json( array(
    ‘count’ => yith_wcwl_count_all_products()
    ) );
    }

    add_action( ‘wp_ajax_yith_wcwl_update_wishlist_count’, ‘yith_wcwl_ajax_update_count’ );
    add_action( ‘wp_ajax_nopriv_yith_wcwl_update_wishlist_count’, ‘yith_wcwl_ajax_update_count’ );
    }

    if ( defined( ‘YITH_WCWL’ ) && ! function_exists( ‘yith_wcwl_enqueue_custom_script’ ) ) {
    function yith_wcwl_enqueue_custom_script() {
    wp_add_inline_script(
    ‘jquery-yith-wcwl’,

    jQuery( function( $ ) {
    $( document ).on( ‘added_to_wishlist removed_from_wishlist’, function() {
    $.get( yith_wcwl_l10n.ajax_url, {
    action: ‘yith_wcwl_update_wishlist_count’
    }, function( data ) {
    $(‘.yith-wcwl-items-count’).children(‘i’).html( data.count );
    } );
    } );
    } );

    );
    }

    add_action( ‘wp_enqueue_scripts’, ‘yith_wcwl_enqueue_custom_script’, 20 );
    }

    i put this new code
    and now all seems work

    • This reply was modified 3 years, 1 month ago by nikketrikke.
Viewing 1 replies (of 1 total)
  • The topic ‘Add Heart Icon on menu Header’ is closed to new replies.