Title: Common Issue &#8211; SyntaxError: Unexpected Token
Last modified: August 30, 2016

---

# Common Issue – SyntaxError: Unexpected Token

 *  Resolved [sachristan](https://wordpress.org/support/users/sachristan/)
 * (@sachristan)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/)
 * This doesn’t seem to work at all, we still get daily people with multiple orders
   after they have received a SyntaxError: Unexpected Token.
 * Posted solution below:
 * > If you see this during checkout for example, it means that a plugin or theme
   > is throwing a notice during the ajax post and breaking the response.
   > To find out which plugin is doing this, view your sever error logs and look
   > for notices. Your host may be able to help you look for this log if you cannot
   > locate it.
   > To prevent plugins and themes from outputting notices entirely, ensure debug
   > mode is off in your wp-config file:
   > define(‘WP_DEBUG’, false);
   >  error_reporting(0); @ini_set(‘display_errors’, 
   > 0);
 * Can someone point us in the right direction we have customers who are sending
   in duplicate orders after their initial order has been accepted.
 * Thanks
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

Viewing 15 replies - 1 through 15 (of 50 total)

1 [2](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/page/3/?output_format=md)
[4](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/page/4/?output_format=md)
[→](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/page/2/?output_format=md)

 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460539)
 * It’s your gateway. If you check server error logs it will list notices/warnings
   etc,
 * I’ve also seen gateways returning HTML instead of the correct array which again
   causes this issue.
 * What payment gateway?
 *  [honestaeb](https://wordpress.org/support/users/honestaeb/)
 * (@honestaeb)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460581)
 * I have the same problem. The code provided above (Placed into wp-config.php) 
   doesn’t suppress this error message on one of my shops. The payment gateway I’m
   using is Authorize.net AIM (Purchased from Woothemes).
 * I’ve examined my server error logs, which are not showing any errors. Using the
   WP Debug (debug.log) is showing me an error for WP Super Cache. Disabling the
   cache hasn’t resolved the problem.
 * I’ve examined the AJAX response on my checkout, which begins with the HTML of
   my admin new order email. After the HTML, I can see the actual AJAX, which looks
   like:
 * {“result”:”success”,”redirect”:”https:\/\/www.mysite.com\/checkout\/order-received\/
   9999?key=wc_order_55ce2544a3486
    &utm_nooverride=1″}
 * 4 requests
 * 5.2 KB
 * 4.63s
 * For now, I’ve been able to keep customers from submitting duplicate orders by
   placing a message at the top of my checkout page, but obviously I’d like to get
   this resolved ASAP and remove the message.
 *  Thread Starter [sachristan](https://wordpress.org/support/users/sachristan/)
 * (@sachristan)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460582)
 * We use the same payment gateway premium Authorize.net, we have 5 other woo commerce
   stores, this is the only one giving us this problem.
 * We thought about putting a site wide message ourselves but this is becoming a
   great problem.
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460592)
 * [@honestaeb](https://wordpress.org/support/users/honestaeb/) Thats the correct
   response. Can you screenshot that? Was there anything before the first { such
   as text or white space?
 *  [honestaeb](https://wordpress.org/support/users/honestaeb/)
 * (@honestaeb)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460610)
 * Sure. Here are screenshots of the beginning and ending of the AJAX response:
 * [ Beginning of Response](http://i60.tinypic.com/2d82ik2.jpg)
 * [Bottom of Response](http://i60.tinypic.com/aneoua.jpg)
 * It does look like there is a line break at the beginning of the response (And
   Firefox returns the error: “SyntaxError: JSON.parse: unexpected character at 
   line 2 column 1 of the JSON data”). The bottom looks OK, though.
 * My child theme’s admin-new-order.php appears to be identical to the one provided
   by WooCommerce (Except I modded mine to include a product thumbnail).
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460620)
 * honestaeb it should not be returning the HTML above the response. Thats the error.
   It should only be returning the JSON at the bottom.
 * Can you rule out your other plugins quickly, not AIM, and see if they are adding
   this? I just spoke to Becka from SkyVerge and they have tested AIM again just
   now without issue.
 *  [honestaeb](https://wordpress.org/support/users/honestaeb/)
 * (@honestaeb)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460636)
 * Found the plugin causing the problem. Unfortunately, it’s a 3rd-party plugin,
   so I’m following up with that developer to get a solution. Thanks for your help!!
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460641)
 * Which one, so we all know?
 *  [honestaeb](https://wordpress.org/support/users/honestaeb/)
 * (@honestaeb)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460643)
 * The plugin is Vendor Stores from Ignitewoo.com
 *  [IgniteWoo Team](https://wordpress.org/support/users/ignitewoo/)
 * (@ignitewoo)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460668)
 * That’s a bit odd – we have no reports of similar behavior. But we’re willing 
   to have a close look and help find out why this happens. I see that you’ve contacted
   us directly, so we’ll be in touch via email 🙂
 *  [littlebizzy](https://wordpress.org/support/users/littlebizzy/)
 * (@littlebizzy)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460821)
 * For those still following this error, yes, the new WooCommerce update “caused”
   this with some radical code changes. Woo is blaming various payment gateways,
   however, WC should probably have kept their code more compatible with existing
   gateways (or worked with plugin authors to prepare for such a radical change 
   in code).
 * [http://www.woothemes.com/2015/08/woocommerce-2-4-release/#comment-2074447](http://www.woothemes.com/2015/08/woocommerce-2-4-release/#comment-2074447)
 * Vendor Stores
    PayPal for WooCommerce WooCommerce PayPal Standard (Multi Account)
   Aelia Currency Switcher for WooCommerce
 * … among other payment gateway plugins are showing this Syntax error.
 * [https://wordpress.org/support/topic/24-common-issue-syntaxerror-unexpected-token](https://wordpress.org/support/topic/24-common-issue-syntaxerror-unexpected-token)
 * The official “fix” by WooCommerce (above link) is merely to disable error reporting
   in WordPress and check your server logs to see which gateway payment plugin is
   throwing errors on your server (not really a fix at all). You will probably need
   to contact the author of your gateway plugin and/or pray for a WooCommerce update
   soon that is more compatible with the dozens of gateway plugins out there.
 * In our case, no error was being shown in server logs, so there is truly no easy
   way to diagnose this for most webmasters.
 * Overall a disappointing WC release, and the first major release since Automattic
   took over WooThemes. Many UI errors being reported as well. But WC has an amazing
   team so let’s hope they learn a lot from the 2.4 nightmares and incorporate those
   lessons into future development. Cheers!
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460833)
 * [@littlebizzy](https://wordpress.org/support/users/littlebizzy/) The only change
   here is enforcing valid JSON rather than allowing any response. Any output from
   a plugin, be that a notice, warning, or echoing of HTML, will break this valid
   JSON response.
 * In the call for beta testers, and prompts for developers to test code, no reports
   came in about the above, no one asked that it change, no Woo gateways broke.
 * If by compatible you mean more forgiving of errors, fine, but thats not a great
   solution either 🙂
 *  Thread Starter [sachristan](https://wordpress.org/support/users/sachristan/)
 * (@sachristan)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460835)
 * This issue was never resolved, we are still getting these errors with no solution
   from woo commerce and every plugin developer saying that its woocommerce not 
   their plugin. This blame game can go all day if thats their positions. This issue
   has not been resolved by any stretch of the imagination.
 *  [kodzero](https://wordpress.org/support/users/kodzero/)
 * (@kodzero)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460836)
 * Hello, again and sorry for my English.
 * I have that problem too
    SyntaxError: Unexpected token
 * Pls fix that bug next release.
 * Another many people have problem too [http://www.kriesi.at/support/topic/woocommerce-update-breaks-checkout-syntaxerror-unexpected-token/](http://www.kriesi.at/support/topic/woocommerce-update-breaks-checkout-syntaxerror-unexpected-token/)
 *  [pixelyzed](https://wordpress.org/support/users/pixelyzed/)
 * (@pixelyzed)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/#post-6460838)
 * Exact same problem here:
 * SyntaxError: Unexpected token <
 * Disabled all plugins but WooCommerce on my local copy, changed theme to TwentyTwelve,
   added the above code in wp-config. Nothing works. Still getting that error.

Viewing 15 replies - 1 through 15 (of 50 total)

1 [2](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/page/3/?output_format=md)
[4](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/page/4/?output_format=md)
[→](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/page/2/?output_format=md)

The topic ‘Common Issue – SyntaxError: Unexpected Token’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [errors](https://wordpress.org/support/topic-tag/errors/)
 * [SyntaxError: Unexpected token](https://wordpress.org/support/topic-tag/syntaxerror-unexpected-token/)
 * [Updates](https://wordpress.org/support/topic-tag/updates/)

 * 50 replies
 * 18 participants
 * Last reply from: [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/common-issue-syntaxerror-unexpected-token/page/4/#post-6460908)
 * Status: resolved