• Hello,

    I am using free version plugin after last update count wishlist product not working. I am using this function YITH_WCWL()->count_products();

    • This topic was modified 5 years, 3 months ago by nikunjw3nuts.
Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi, could you please confirm me that this issue only happens for guest users?
    Is count correct for logged in customers?

    We just released a new version of the plugin (3.0.3)
    Could you please update and let me know if this solves the issue?

    Hi, this issue persists even after I updated the version 3.0.3.

    This issue is for both guest users and logged users.

    Thanks!

    Plugin Author YITHEMES

    (@yithemes)

    @bizit In this case, I’ll need some additional informations

    It would be wonderful if you could do some guided debug, but please, proceed only if you’re testing on a staging environment

    First step in order to proceed is to understand if system is able to retrieve default wishlist.
    Please, follow these steps:

    1. Add the following snippet of code at the end of functions.php file of your theme or child (Please, remember to remove it as we’re done debugging!)

    if( ! function_exists( 'yith_wcwl_debug_default_wishlist' ) ){
        function yith_wcwl_debug_default_wishlist(){
            if( ! isset( $_GET['yith_wcwl_debug_default_wishlist'] ) ){
                return;
            }
    
            $default_wishlist = YITH_WCWL_Wishlist_Factory::get_default_wishlist();
    
            var_dump( YITH_WCWL_Session()->get_session_id() );
            var_dump( $default_wishlist );
            var_dump( $default_wishlist ? $default_wishlist->get_items() : array() );
            var_dump( YITH_WCWL()->count_products() );
            die;
        }
        add_action( 'init', 'yith_wcwl_debug_default_wishlist' );
    }

    2. As a logged in user, add a brand new item to your wishlist
    3. Visit your homepage, appending ?yith_wcwl_debug_default_wishlist query string to the url
    4. This should prompt some debug informations; please, share them with us
    5. Repeat steps 2-4, but this time as a guest user, in Incognito mode

    In both cases system should print some info regarding wishlist status
    Please, let me know

    Wish is not work for my site either

    so i did the troubleshoot as you asked above:

    andwhen i query my site like this: https://shopcandyclass.com/?yith_wcwl_debug_default_wishlist

    this is what returned:

    string(32) “8d9a05e43ca27140fae23b8943ce354b” bool(false) array(0) { } int(0)

    Hello,

    I changed the file “class.yith-wcwl-wishlist-item-data-store.php” to the line 271.

    $sql .= " AND i.wishlist_idIS NULL";

    with

    $sql .= " AND i.wishlist_idIS NOT NULL";

    and it works well.

    Thanks

    Thread Starter nikunjw3nuts

    (@nikunjw3nuts)

    Hello @yithemes @bizit @dmathew011

    yith_wcwl_count_products() this function work for me

    Plugin Author YITHEMES

    (@yithemes)

    Hi

    @dmathew011 I checked your site, and I think that the problem is not with counter.
    Products are not added to the wishlist, since Add to Wishlist button seems to be broken

    I think that your theme overrides default add-to-wishlist.php template, and this is causing the problem
    Anyway, I checked their landing page, and it seems that yesterday they released a compatibility update; do you think you could try to update the theme and see if this solves the issue?

    @bizit Could you please confirm me that you’re using YITH_WCWL()->count_products();?
    I ask since that method shouldn’t make use of the piece of code that you highlighted: for db interaction, count_products method should call instead: \YITH_WCWL_Wishlist_Data_Store::read_items

    @nikunjw3nuts Thank you for sharing this with us: yith_wcwl_count_products() is actually just a wrapper for YITH_WCWL()->count_products(), and this confirms me that this method should work

    • This reply was modified 5 years, 3 months ago by YITHEMES.

    Hello,

    It’s not about YITH_WCWL()->count_products(); but about YITH_WCWL()->count_all_products();

    YITH_WCWL()->count_all_products(); it did not work.

    Thread Starter nikunjw3nuts

    (@nikunjw3nuts)

    Hello,

    yith_wcwl_count_products() function not working with WPML plugins

    Plugin Author YITHEMES

    (@yithemes)

    @bizit you’re right about YITH_WCWL()->count_all_products();

    Version 3.0.4 will contain a fix to this issue

    @nikunjw3nuts could you please explain the problem better?
    I tested plugin with WPML, and I got the same count among various languages
    This happens because wishlist is shared across all languages: system will store products in base language, and translate them when showing the list

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Wishlist count product not working after update plugin’ is closed to new replies.