Title: Unexpected Token (SQL Error)
Last modified: November 10, 2018

---

# Unexpected Token (SQL Error)

 *  [iObject](https://wordpress.org/support/users/iobject/)
 * (@iobject)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/unexpected-token-sql-error/)
 * Hi, I’m using the latest version of WooCommerce POS and it seems whenever I initiate
   a checkout specifically with the POS System, I get an error for “Unexpected token
   < in JSON at position 0”. This doesn’t happen when a checkout is initiated through
   the website’s front-end.
 * When I expand the details with the “i” button, I get this:
 *     ```
       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 '0 WHERE post_id='202715' AND meta_key='_sku' LIMIT 1' at line 1]
       SELECT meta_value FROM 0 WHERE post_id='202715' AND meta_key='_sku' LIMIT 1
   
       {"id":217488,"parent_id":0,"number":"217488","order_key":"wc_order_5be62281aecb0","created_via":"rest-api","version":"3.4.7","status":"completed","currency":"USD","date_created":"2018-11-09T17:12:49","date_created_gmt":"2018-11-10T00:12:49","date_modified":"2018-11-09T17:12:50","date_modified_gmt":"2018-11-10T00:12:50","discount_total":"0.00","discount_tax":"0.00","shipping_total":"0.00","shipping_tax":"0.00","cart_tax":"0.23","total":"2.72","total_tax":"0.23","prices_include_tax":false,"customer_id":0,"customer_ip_address":"","customer_user_agent":"","customer_note":"","billing":{"first_name":"","last_name":"","company":"","address_1":"","address_2":"","city":"","state":"","postcode":"","country":"","email":"","phone":""},"shipping":{"first_name":"","last_name":"","company":"","address_1":"","address_2":"","city":"","state":"","postcode":"","country":""},"payment_method":"pos_cash","payment_method_title":"Cash","transaction_id":"","date_paid":"2018-11-09T17:12:50","date_paid_gmt":"2018-11-10T00:12:50","date_completed":"2018-11-09T17:12:50","date_completed_gmt":"2018-11-10T00:12:50","cart_hash":"","meta_data":[{"id":4738725,"key":"_pos","value":"1"},{"id":4738726,"key":"_pos_user","value":"4"},{"id":4738727,"key":"_pos_user_name","value":"(Redacted) "},{"id":4738728,"key":"_pos_cash_amount_tendered","value":"2.7216"},{"id":4738729,"key":"_pos_cash_change","value":"0"},{"id":4738734,"key":"_pos_payment_result","value":"success"},{"id":4738735,"key":"_pos_payment_message","value":""}],"line_items":[{"id":716,"name":"(Redacted)","product_id":202715,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"2.49","subtotal_tax":"0.23","total":"2.49","total_tax":"0.23","taxes":[{"id":1,"total":"0.2316","subtotal":"0.2316"}],"meta_data":[],"sku":"W0900","price":2.4900000000000002131628207280300557613372802734375,"composite_parent":"","composite_children":[],"meta":[]}],"tax_lines":[{"id":717,"rate_code":"AZ-SALES TAX-1","rate_id":1,"label":"Sales Tax","compound":false,"tax_total":"0.23","shipping_tax_total":"0.00","meta_data":[]}],"shipping_lines":[],"fee_lines":[],"coupon_lines":[],"refunds":[],"cashier":{"id":"4","first_name":"(Redacted)","last_name":""},"payment_details":{"result":"success","message":"","redirect":"","method_id":"pos_cash","method_title":"Cash","paid":true,"method_pos_cash":{"tendered":"2.7216","change":"0"}},"note":"","total_discount":"0.00","total_shipping":"0.00","order_number":"217488","updated_at":"2018-11-09T17:12:50","billing_address":{"first_name":"","last_name":"","company":"","address_1":"","address_2":"","city":"","state":"","postcode":"","country":"","email":"","phone":""},"shipping_address":{"first_name":"","last_name":"","company":"","address_1":"","address_2":"","city":"","state":"","postcode":"","country":""},"completed_at":"2018-11-09T17:12:49","_links":{"self":[{"href":"(Redacted)"}],"collection":[{"href":"(Redacted)"}]}}
       ```
   
    -  This topic was modified 7 years, 6 months ago by [iObject](https://wordpress.org/support/users/iobject/).

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

 *  Thread Starter [iObject](https://wordpress.org/support/users/iobject/)
 * (@iobject)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/unexpected-token-sql-error/#post-10877257)
 * To add a bit more detail, if that makes it easier to respond to, the orders still
   post on the “Orders” section of our backend. The only thing this error prevents
   us from doing is printing the receipt and opening the cash drawer automatically.
 *  Plugin Author [kilbot](https://wordpress.org/support/users/kilbot/)
 * (@kilbot)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/unexpected-token-sql-error/#post-10879807)
 * Hi,
 * It seems there is an error when WooCommerce tries to retrieve the SKU for the
   product. Two things to check:
    1. Are you using any plugins that may effect the product SKU? If so you could try
       temporarily disabling the plugin to see if it fixes the error.
    2. Does this error only show for this one product (ID = 202715), or does it effect
       all products?
 *  Thread Starter [iObject](https://wordpress.org/support/users/iobject/)
 * (@iobject)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/unexpected-token-sql-error/#post-10880759)
 * 1) None of my plugins affect product SKUs, but not all products have an SKU. 
   Regardless, the error I posted above was for a product that had an SKU on it.
   
   2) It affects all products.
 * As for plugins, here are my WooCommerce-specific plugins:
    The official WooCommerce
   Wishlists plugin The official WooCommerce Composite Products plugin USPS (Basic)
   WooCommerce Shipping
 * The only one of these that I could see potentially being a problem is the Composite
   Products plugin, but something also tells me it’s not that.

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

The topic ‘Unexpected Token (SQL Error)’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pos/assets/icon-256x256.png?rev=3109703)
 * [WCPOS - Point of Sale (POS) plugin for WooCommerce](https://wordpress.org/plugins/woocommerce-pos/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pos/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pos/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pos/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pos/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pos/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [iObject](https://wordpress.org/support/users/iobject/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/unexpected-token-sql-error/#post-10880759)
 * Status: not resolved