https:\/\/wordpress.org\/support\/topic\/24-common-issue-syntaxerror-unexpected-token?replies=1<\/a>.<\/p>\nVypnete zobrazov\u00e1n\u00ed chyb a tv\u00e1\u0159\u00edte se, jako \u017ee se nic nestalo.<\/p>\n
S t\u00edm jsem se ale nemohl sm\u00ed\u0159it.<\/p>\n
Pono\u0159il jsem se do zdrojov\u00e9ho k\u00f3du a na\u0161el jsem zp\u016fsob, jak detekovat chybu, kter\u00e1 hl\u00e1\u0161en\u00ed zp\u016fsobuje.<\/p>\n
Ve slo\u017ece woocommerce\/assets\/frontend najdete dva soubory, checkout.js a checkout.min.js.<\/p>\n
Ty si nejprve z\u00e1lohujte a otev\u0159ete soubor checkout.js.<\/p>\n
Na \u0159\u00e1dku 359 najdete tento k\u00f3d:<\/p>\n
\nerror:\tfunction( jqXHR, textStatus, errorThrown ) {\n wc_checkout_form.submit_error( '' + errorThrown + '<\/div>' );\n}\n<\/pre>\n
Ten upravte na:<\/p>\n
\nerror:\tfunction( jqXHR, textStatus, errorThrown ) {\n wc_checkout_form.submit_error( '' + errorThrown + '<\/div>' );\n console.log(jqXHR);\n}\n<\/pre>\n
V Chrome otev\u0159ete v\u00e1\u0161 eshop, developerskou konzoli a z\u00e1lo\u017eku Console.
\nPak vlo\u017ete zbo\u017e\u00ed do ko\u0161\u00edku a na str\u00e1nce pokladny vytvo\u0159te objedn\u00e1vku.<\/p>\n
Z\u00e1pis v konzoli by m\u011bl zobrazit text, za\u010d\u00ednaj\u00edc\u00ed – „object { readyState: 4, responseText:“.
\nV textu ji\u017e najdete chybu, kterou je pot\u0159eba vy\u0159e\u0161it.<\/p>\n
A\u017e chybu odstran\u00edte, nezapome\u0148te znovu obnovit oba js soubory, proto\u017ee j\u00e1dro pluginu z\u00e1sadn\u011b neupravujeme.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"Mo\u017en\u00e1 jste se s t\u00edm ji\u017e setkali po aktualizaci WooCommerce na verzi 2.4. a vy\u0161\u0161\u00ed. V pokladn\u011b se objedn\u00e1vka nep\u0159esm\u011bruje na d\u011bkovnou str\u00e1nku a m\u00edsto toho se zobraz\u00ed chybov\u00e9 hl\u00e1\u0161en\u00ed –\u00a0SyntaxError: Unexpected token <. A nic v\u00edc. Nikde \u017e\u00e1dn\u00e1 informace o souboru, v kter\u00e9 se chyba nach\u00e1z\u00ed. D\u00edky tomu, \u017ee checkout ve WooCommerce je kontrolov\u00e1n<\/p>\n","protected":false},"author":1,"featured_media":8732,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,19,25],"tags":[371],"class_list":["post-2562","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-navody","category-snippety","category-woocommerce","tag-syntaxerror-unexpected-token"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2562"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=2562"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2562\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/8732"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=2562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=2562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=2562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}