Title: Wrong SQL in class.yith-wcwl.php
Last modified: August 31, 2016

---

# Wrong SQL in class.yith-wcwl.php

 *  [codexhemes](https://wordpress.org/support/users/codexhemes/)
 * (@codexhemes)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/wrong-sql-in-classyith-wcwlphp/)
 * Hi,
 * pls check thsi screenshot: [http://storage9.static.itmages.com/i/16/0531/h_1464701256_9908753_c104336fc0.jpeg](http://storage9.static.itmages.com/i/16/0531/h_1464701256_9908753_c104336fc0.jpeg)
 * there are problems with adding more than 4 items to wishlist because of wrong
   SQL in yith-woocommerce-wishlist/includes/class.yith-wcwl.php, rows 625-629
 * Group should be first, after that limit
 * [https://wordpress.org/plugins/yith-woocommerce-wishlist/](https://wordpress.org/plugins/yith-woocommerce-wishlist/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [giuseppeimperioso](https://wordpress.org/support/users/giuseppeimperioso/)
 * (@giuseppeimperioso)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/wrong-sql-in-classyith-wcwlphp/#post-7433509)
 * Hi, we have the same problem, it’s about malformed query generated by method “
   get_products” in class.yith-wcwl.php
 * I have fixed as follow the method:
 * Line 620-633:
 *     ```
       if( ! empty( $id ) ){
                           $sql .= " AND <code>i.ID</code> = %d";
                           $sql_args[] = $id;
                       }
   
                       $sql .= " GROUP BY i.prod_id, l.ID";
   
                       if( ! empty( $limit ) ){
                           $sql .= " LIMIT " . $offset . ", " . $limit;
                       }
   
                       $wishlist = $wpdb->get_results( $wpdb->prepare( $sql, $sql_args ), ARRAY_A );
       ```
   
 * [Complete File ](http://pastebin.com/tJ5Udduj)
    Ciao 😀
 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/wrong-sql-in-classyith-wcwlphp/#post-7433604)
 * Hi Guys
 * thank you for your report 🙂
 * we already fixed this problem on our dev trunk, and we will release the fix ASAP
 * Unfortunately, we’re in the middle of WC 2.6 compatibility fixes, so we may need
   some time before we can send a stable revision of the plugin
 * Thank you again
    Have a nice day 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Wrong SQL in class.yith-wcwl.php’ is closed to new replies.

 * ![](https://ps.w.org/yith-woocommerce-wishlist/assets/icon-128x128.gif?rev=3129302)
 * [YITH WooCommerce Wishlist](https://wordpress.org/plugins/yith-woocommerce-wishlist/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yith-woocommerce-wishlist/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yith-woocommerce-wishlist/)
 * [Active Topics](https://wordpress.org/support/plugin/yith-woocommerce-wishlist/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yith-woocommerce-wishlist/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yith-woocommerce-wishlist/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/wrong-sql-in-classyith-wcwlphp/#post-7433604)
 * Status: not resolved