Title: [Plugin: WooCommerce] SyntaxError: Unexpected token
Last modified: August 30, 2016

---

# [Plugin: WooCommerce] SyntaxError: Unexpected token

 *  [IltikA](https://wordpress.org/support/users/iltika/)
 * (@iltika)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/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 1 replies (of 1 total)

 *  Thread Starter [IltikA](https://wordpress.org/support/users/iltika/)
 * (@iltika)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/plugin-woocommerce-syntaxerror-unexpected-token/#post-6746024)
 * Update on the issue:
    I change $imgfile from a post_meta to a hard written url.
 * as exemple:
    [http://media-dev.glidentity.com/2015/04/favicon-192×192.png](http://media-dev.glidentity.com/2015/04/favicon-192×192.png)
   NO WORKING [http://media-dev.glidentity.com/2015/04/favicon-192×19.png](http://media-dev.glidentity.com/2015/04/favicon-192×19.png)
   WORKING [http://media-dev.glidentity.com/2015/04/favicon-192×192.pn](http://media-dev.glidentity.com/2015/04/favicon-192×192.pn)
   WORKING [http://images.dailytech.com/nimage/Google_Icon_Redesign_20](http://images.dailytech.com/nimage/Google_Icon_Redesign_20)
   WORKING [http://images.dailytech.com/nimage/Google_Icon_Redesign_2008_Denis_Kortunov_Screenshot_Wide.png](http://images.dailytech.com/nimage/Google_Icon_Redesign_2008_Denis_Kortunov_Screenshot_Wide.png)
   NOT WORKING
 * A variable length limitation?

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: WooCommerce] SyntaxError: Unexpected token’ is closed to new
replies.

## Tags

 * [cdata](https://wordpress.org/support/topic-tag/cdata/)
 * [syntaxerror](https://wordpress.org/support/topic-tag/syntaxerror/)
 * [xml](https://wordpress.org/support/topic-tag/xml/)

 * 1 reply
 * 1 participant
 * Last reply from: [IltikA](https://wordpress.org/support/users/iltika/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/plugin-woocommerce-syntaxerror-unexpected-token/#post-6746024)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
