• Hi,

    I have my own custom theme.

    I have a category page with product cards. I want to add the add to wishlist button (the heart icon). I use the following shortcode but nothing being added:?echo do_shortcode(“[yith_wcwl_add_to_wishlist product_id=123 label=dfbd]”);.

    Show “Add to wishlist” in loop is enabled.

    Please advise.

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

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

    (@juaancmendez)

    Hello there,
    we hope you’re doing well!

    The shortcode should look correct, although I don’t know exactly how you are adding it. I recommend adding it directly to your theme template, or if you don’t know how to do this, contact your theme support to see how to add the shortcode to the product category page.

    We will be attentive to any news.

    Best regards.

    Thread Starter romantheguy

    (@romantheguy)

    Hi Juan,

    I am adding the shortcode in the code of my theme. I have a template part “product-card”. In the code of this template part I add:

     echo do_shortcode(“[yith_wcwl_add_to_wishlist product_id=123 label=dfbd]”);

    Plugin Support Juan Coronel

    (@juaancmendez)

    Hi there,

    Try adding the following code in the functions.php of your active theme:

    if (defined('YITH_WCWL')) {
        if (!function_exists('yith_wcwl_enqueue_back_required_assets')) {
            function yith_wcwl_enqueue_back_required_assets()
            {
                $suffix  = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
                $version = defined('WC_VERSION') ? WC_VERSION : '';
    
                wp_enqueue_style('woocommerce_prettyPhoto_css', plugins_url('assets/css/prettyPhoto.css', WC_PLUGIN_FILE), array(), $version);
                wp_enqueue_script('prettyPhoto', plugins_url('assets/js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', WC_PLUGIN_FILE), array('jquery'), '3.1.6');
                wp_enqueue_script('prettyPhoto-init', plugins_url('assets/js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', WC_PLUGIN_FILE), array('jquery'), $version);
    
    
                wp_enqueue_style('yith-wcwl-main', YITH_WCWL_URL . 'assets/css/style.css', array('jquery-selectBox'));
            }
            add_action( 'wp_enqueue_scripts', 'yith_wcwl_enqueue_back_required_assets', 9999 );
        }
        if (!function_exists('ywfav_add_fontawesome')) {
            function ywfav_add_fontawesome()
            {
                wp_enqueue_style('fontawsome', 'https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
            }
            add_action( 'wp_enqueue_scripts', 'ywfav_add_fontawesome', 99 );	
        }
    }

    If still not work, I recommend you to contact your theme support in order to see how add the shortcode in the theme template.

    Let us know any news.

    Best regards.

    Thread Starter romantheguy

    (@romantheguy)

    Hi Juan,

    Unfortunately your code did not help.
    But I did noticed the following: the shortcode does work on the whishlist page and single products page. But it does not work on my custom page-templates.
    One more thing, I use “wp_query” not “wc_product_loop”. Is this the problem? Can I some how enable the whishlist shortcode on my cutom templates?
    Thanks.

    Plugin Support Juan Coronel

    (@juaancmendez)

    Hello there,

    Could you share the link of your custom page where you insert the shortcode but it doesn’t work?

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add to wishlist shortcode not working’ is closed to new replies.