Quantcast
Viewing all articles
Browse latest Browse all 3201

IltikA on "[Plugin: WooCommerce] SyntaxError: Unexpected token"

Hi,

So I am making a plugin that send an xml via curl when the order is processing.
I have a SyntaxError: Unexpected token < during Checkout.

Code that dont make the error

$xml .= '<logo>
<unique_id>'. $uid .'</unique_id>';
$xml .= '<position>'. $position .'</position>
<width>'. $width .'</width>
<type>'. $print .'</type>
</logo>';

Code that make the error

$xml .= '<logo>
<unique_id>'. $uid .'</unique_id>';
$xml .= '<file><![CDATA['. $imgfile .']]></file>';
$xml .= '<position>'. $position .'</position>
<width>'. $width .'</width>
<type>'. $print .'</type>
</logo>';

File is a correct url, it doesn't contain any specific character.
The xml is sent correctly but the wc return to the place order page with SyntaxError: Unexpected token <

Any ideas why and how I can avoid having that error? I am running out of ideas on what to do!

note that
$xml .= '<file>'. $imgfile .'</file>';
Also have the error so it's not the CDATA (or so I think!).

note2
$xml is not empty before I concatenate.


Viewing all articles
Browse latest Browse all 3201

Trending Articles