Support » Plugin: YITH WooCommerce Compare » compare

  • How get the number of products to compare? (frontend)
    How to make a link to open a lightbox with the goods to compare? (frontend)

Viewing 1 replies (of 1 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi,
    for count the product on compare you have to do something like that

    
    $products_list = isset( $_COOKIE[ $this->cookie_name ] ) ? json_decode( $_COOKIE[ $this->cookie_name ] ) : array();
    $count_products = count( $products_list );
    

    so, $count_products is the number of products currently on compare table.
    About the second question you can retrive the compare view link with this code

    
    global $yith_woocompare;
    if( ! is_admin() ){
    	$view_compare = $yith_woocompare->obj->view_table_url();
    }
    

    $view_compare is the link to open the compare table.

    Hope this is helpful for you. Regards 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘compare’ is closed to new replies.