• I need to get the number of products that are in my favorites list. The shortcode is not suitable because I only need the number, not the finished html code!

    I tried it this way, but got an error:

    <?php if ( class_exists( 'WishSuite_Base' ) ) : ?>

           <a href="/wishlist/" class="btn p-1">

                 <span id="icde_wishlist_count"

                                        class="wishlist-count badge text-bg-warning cart-badge bg-warning rounded-circle">

                       <?php echo

                            $products   = Manage_Wishlist::instance()->get_products_data();

                            echo count($products)

                       ?>

                   </span>

            </a>

    <?php endif; ?>



Viewing 1 replies (of 1 total)
  • Hi @icopydoc ,

    Thank you very much for reaching out.

    The error you encountered is likely because of a small issue with how you are calling the Manage_Wishlist class. To fix this and get the number of products in your wishlist, you can use the following code:

    <?php
    if ( class_exists( 'WishSuite_Base' ) ) : ?>
        <a href="/wishlist/" class="btn p-1">
            <span id="icde_wishlist_count" class="wishlist-count badge text-bg-warning cart-badge bg-warning rounded-circle">
                <?php 
                    $products = \WishSuite\Frontend\Manage_Wishlist::instance()->get_products_data();
                    echo count($products);
                ?>
            </span>
        </a>
    <?php endif; ?>
    

    This should return only the number of products in your wishlist, without the full HTML structure.

    Let me know if this works or if you encounter any further issues!

    Best regards,
    Kamal

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.