Title: Woocommerce Multilingual 4.2 causing SQL syntax error
Last modified: July 28, 2017

---

# Woocommerce Multilingual 4.2 causing SQL syntax error

 *  Resolved [gore.m](https://wordpress.org/support/users/gorem/)
 * (@gorem)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/woo-multilingual-causing-sql-syntax-error/)
 * Hello,
 * Im pernametly getting SQL syntax error caused by Woo Multilingual v4.2 :
 *     ```
       Jul 28, 06:20:20
       WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY posts.post_parent' at line 6 for query SELECT parent_meta__order_total.meta_value as total_refund, parent_meta__order_shipping.meta_value as total_shipping, parent_meta__order_tax.meta_value as total_tax, parent_meta__order_shipping_tax.meta_value as total_shipping_tax, posts.post_date as post_date FROM wp_posts AS posts INNER JOIN wp_postmeta AS parent_meta__order_total ON (posts.post_parent = parent_meta__order_total.post_id) AND (parent_meta__order_total.meta_key = '_order_total') INNER JOIN wp_postmeta AS parent_meta__order_shipping ON (posts.post_parent = parent_meta__order_shipping.post_id) AND (parent_meta__order_shipping.meta_key = '_order_shipping') INNER JOIN wp_postmeta AS parent_meta__order_tax ON (posts.post_parent = parent_meta__order_tax.post_id) AND (parent_meta__order_tax.meta_key = '_order_tax') INNER JOIN wp_postmeta AS parent_meta__order_shipping_tax ON (posts.post_parent = parent_meta__order_shipping_tax.post_id) AND (parent_meta__order_shipping_tax.meta_key = '_order_shipping_tax') LEFT JOIN wp_posts AS parent ON posts.post_parent = parent.ID
       WHERE posts.post_type IN ( 'shop_order','shop_order_refund' )
       AND parent.post_status IN ( 'wc-refunded')
       AND posts.post_date >= '2017-07-01 00:00:00'
       AND posts.post_date < '2017-07-29 06:20:20'
       AND posts.ID IN ( ) GROUP BY posts.post_parent made by wp_dashboard, do_meta_boxes, WC_Admin_Dashboard->status_widget, WC_Admin_Dashboard->get_sales_report_data, WC_Report_Sales_By_Date->get_report_data, WC_Report_Sales_By_Date->query_report_data, WC_Admin_Report->get_order_report_data
       Jul 28, 06:20:20
       WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY refund_id ORDER BY post_date ASC' at line 6 for query SELECT posts.ID as refund_id, meta__refund_amount.meta_value as total_refund, posts.post_date as post_date, order_items.order_item_type as item_type, meta__order_total.meta_value as total_sales, meta__order_shipping.meta_value as total_shipping, meta__order_tax.meta_value as total_tax, meta__order_shipping_tax.meta_value as total_shipping_tax,SUM( order_item_meta__qty.meta_value) as order_item_count FROM wp_posts AS posts INNER JOIN wp_postmeta AS meta__refund_amount ON ( posts.ID = meta__refund_amount.post_id AND meta__refund_amount.meta_key = '_refund_amount' ) LEFT JOIN wp_woocommerce_order_items AS order_items ON (posts.ID = order_items.order_id) INNER JOIN wp_postmeta AS meta__order_total ON ( posts.ID = meta__order_total.post_id AND meta__order_total.meta_key = '_order_total' ) LEFT JOIN wp_postmeta AS meta__order_shipping ON ( posts.ID = meta__order_shipping.post_id AND meta__order_shipping.meta_key = '_order_shipping' ) LEFT JOIN wp_postmeta AS meta__order_tax ON ( posts.ID = meta__order_tax.post_id AND meta__order_tax.meta_key = '_order_tax' ) LEFT JOIN wp_postmeta AS meta__order_shipping_tax ON ( posts.ID = meta__order_shipping_tax.post_id AND meta__order_shipping_tax.meta_key = '_order_shipping_tax' ) LEFT JOIN wp_woocommerce_order_itemmeta AS order_item_meta__qty ON (order_items.order_item_id = order_item_meta__qty.order_item_id) AND (order_item_meta__qty.meta_key = '_qty') LEFT JOIN wp_posts AS parent ON posts.post_parent = parent.ID
       WHERE posts.post_type IN ( 'shop_order','shop_order_refund' )
       AND parent.post_status IN ( 'wc-completed','wc-processing','wc-on-hold')
       AND posts.post_date >= '2017-07-01 00:00:00'
       AND posts.post_date < '2017-07-29 06:20:20'
       AND posts.ID IN ( ) GROUP BY refund_id ORDER BY post_date ASC made by wp_dashboard, do_meta_boxes, WC_Admin_Dashboard->status_widget, WC_Admin_Dashboard->get_sales_report_data, WC_Report_Sales_By_Date->get_report_data, WC_Report_Sales_By_Date->query_report_data, WC_Admin_Report->get_order_report_data
       Jul 28, 06:20:20
       WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY refund_id ORDER BY post_date ASC' at line 6 for query SELECT posts.ID as refund_id, meta__refund_amount.meta_value as total_refund, posts.post_date as post_date, order_items.order_item_type as item_type, meta__order_total.meta_value as total_sales, meta__order_shipping.meta_value as total_shipping, meta__order_tax.meta_value as total_tax, meta__order_shipping_tax.meta_value as total_shipping_tax,SUM( order_item_meta__qty.meta_value) as order_item_count FROM wp_posts AS posts INNER JOIN wp_postmeta AS meta__refund_amount ON ( posts.ID = meta__refund_amount.post_id AND meta__refund_amount.meta_key = '_refund_amount' ) LEFT JOIN wp_woocommerce_order_items AS order_items ON (posts.ID = order_items.order_id) INNER JOIN wp_postmeta AS meta__order_total ON ( posts.ID = meta__order_total.post_id AND meta__order_total.meta_key = '_order_total' ) LEFT JOIN wp_postmeta AS meta__order_shipping ON ( posts.ID = meta__order_shipping.post_id AND meta__order_shipping.meta_key = '_order_shipping' ) LEFT JOIN wp_postmeta AS meta__order_tax ON ( posts.ID = meta__order_tax.post_id AND meta__order_tax.meta_key = '_order_tax' ) LEFT JOIN wp_postmeta AS meta__order_shipping_tax ON ( posts.ID = meta__order_shipping_tax.post_id AND meta__order_shipping_tax.meta_key = '_order_shipping_tax' ) LEFT JOIN wp_woocommerce_order_itemmeta AS order_item_meta__qty ON (order_items.order_item_id = order_item_meta__qty.order_item_id) AND (order_item_meta__qty.meta_key = '_qty') LEFT JOIN wp_posts AS parent ON posts.post_parent = parent.ID
       WHERE posts.post_type IN ( 'shop_order','shop_order_refund' )
       AND parent.post_status IN ( 'wc-completed','wc-processing','wc-on-hold','wc-refunded')
       AND posts.post_date >= '2017-07-01 00:00:00'
       AND posts.post_date < '2017-07-29 06:20:20'
       AND posts.ID IN ( ) GROUP BY refund_id ORDER BY post_date ASC made by wp_dashboard, do_meta_boxes, WC_Admin_Dashboard->status_widget, WC_Admin_Dashboard->get_sales_report_data, WC_Report_Sales_By_Date->get_report_data, WC_Report_Sales_By_Date->query_report_data, WC_Admin_Report->get_order_report_data
       Jul 28, 06:20:20
       WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY product_id ORDER BY qty DESC LIMIT 1' at line 2 for query SELECT SUM( order_item_meta.meta_value ) as qty, order_item_meta_2.meta_value as product_id
       FROM wp_posts as posts INNER JOIN wp_woocommerce_order_items AS order_items ON posts.ID = order_id INNER JOIN wp_woocommerce_order_itemmeta AS order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id INNER JOIN wp_woocommerce_order_itemmeta AS order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id WHERE posts.post_type IN ( 'shop_order' ) AND posts.post_status IN ( 'wc-completed','wc-processing','wc-on-hold' ) AND order_item_meta.meta_key = '_qty' AND order_item_meta_2.meta_key = '_product_id' AND posts.post_date >= '2017-07-01' AND posts.post_date <= '2017-07-28 06:20:20' AND posts.ID IN ( ) GROUP BY product_id ORDER BY qty DESC LIMIT 1 made by wp_dashboard, do_meta_boxes, WC_Admin_Dashboard->status_widget, WC_Admin_Dashboard->get_top_seller
       ```
   
 * Is there an solution, is it known bug?
    Thanks you
    -  This topic was modified 8 years, 9 months ago by [gore.m](https://wordpress.org/support/users/gorem/).

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

 *  [George Botsev](https://wordpress.org/support/users/botzev/)
 * (@botzev)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/woo-multilingual-causing-sql-syntax-error/#post-9360393)
 * Hello and thank you for contacting us.
    Yes, this appears to be known error that
   will be fixed in the next release. The problem happens if there are no orders
   and it is only on the dashboard. A quick and dirty fix is to change in woocommerce-
   multilingual\inc\currencies\class-wcml-multi-currency-reports.php the function:
 *     ```
           public function filter_dashboard_status_widget_sales_query( $query ) {
               $order_ids_list = $this->get_dashboard_currency_list_of_orders_ids();
   
               $query['where'] .= " AND posts.ID IN  ( " . $order_ids_list . " ) ";
   
               return $query;
           }
       ```
   
 * to
 *     ```
       public function filter_dashboard_status_widget_sales_query( $query ) {
               $order_ids_list = $this->get_dashboard_currency_list_of_orders_ids();
   
               if($order_ids_list == '') return $query; 
   
               $query['where'] .= " AND posts.ID IN  ( " . $order_ids_list . " ) ";
   
               return $query;
           }
       ```
   
 * I hope that this helps you as a workaround. We are going to have a better fix
   when the official release is done.
 *  Thread Starter [gore.m](https://wordpress.org/support/users/gorem/)
 * (@gorem)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/woo-multilingual-causing-sql-syntax-error/#post-9360422)
 * Thanks you.
    Because Im in web developing phase, will I need – because of this
   problem – rework my work? …or will next plugin update covering error (in database)
   without causing future problems?
 * Thanks you
 *  [George Botsev](https://wordpress.org/support/users/botzev/)
 * (@botzev)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/woo-multilingual-causing-sql-syntax-error/#post-9360498)
 * You should not need to rework your work.
    The fix will be available in the next
   release – WooCommerce Multilingual 4.2.2
 *  Thread Starter [gore.m](https://wordpress.org/support/users/gorem/)
 * (@gorem)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/woo-multilingual-causing-sql-syntax-error/#post-9360503)
 * Thanks you

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

The topic ‘Woocommerce Multilingual 4.2 causing SQL syntax error’ is closed to new
replies.

 * ![](https://ps.w.org/woocommerce-multilingual/assets/icon-256x256.png?rev=2937122)
 * [WPML Multilingual & Multicurrency for WooCommerce](https://wordpress.org/plugins/woocommerce-multilingual/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-multilingual/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-multilingual/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-multilingual/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-multilingual/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-multilingual/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [gore.m](https://wordpress.org/support/users/gorem/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/woo-multilingual-causing-sql-syntax-error/#post-9360503)
 * Status: resolved