javascript - "SyntaxError: Unexpected token <" in WooCommerce? -


i getting error when changed woocommerce-2.3.13 version woocommerce-2.4.6:

woocommerce: syntaxerror: unexpected token <

as per knowledge, when adding script tag(< script>) on php file, open script tag < giving errors, means not reading script tag.

i added plugin(on php file) connect checkout process payment gateway redirect bank list page. error coming when try redirect using javascript. redirect function header("location:$url") not working using javascript.

?> <script type='text/javascript'>    window.location.href="<?php  echo $url; ?>"; </script > <? 

i tried

define('wp_debug', false);error_reporting(0);@ini_set('display_errors', 0); 

but getting same errors.

when woocommerce checkout processed requires gateways return array (which converted json) telling checkout whether or not successful. it’s been way since v1.

in 2.4+ made more strict in response must valid json. else in response (such html, notices or whitespace) invalidate json , may see error along lines of:

syntaxerror: unexpected token 

see way debug in blog post https://mikejolley.com/2015/11/12/debugging-unexpected-token-in-woocommerce-2-4/

i followed instructions on blog post, disabled plug-ins, , turned out json response sending error instead of correctly formatted json. response was:

<br /> <b>notice</b>:  use of undefined constant curlopt_sslversion -     assumed 'curlopt_sslversion' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/transport/paypalrestcall.php</b> on line <b>57</b><br /> <br /> <b>notice</b>:  use of undefined constant curlopt_connecttimeout - assumed 'curlopt_connecttimeout' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/transport/paypalrestcall.php</b> on line <b>57</b><br /> <br /> <b>notice</b>:  use of undefined constant curlopt_returntransfer - assumed 'curlopt_returntransfer' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/transport/paypalrestcall.php</b> on line <b>57</b><br /> <br /> <b>notice</b>:  use of undefined constant curlopt_timeout - assumed 'curlopt_timeout' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/transport/paypalrestcall.php</b> on line <b>57</b><br /> <br /> <b>notice</b>:  use of undefined constant curlopt_useragent - assumed 'curlopt_useragent' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/transport/paypalrestcall.php</b> on line <b>57</b><br /> <br /> <b>notice</b>:  use of undefined constant curlopt_httpheader - assumed 'curlopt_httpheader' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/transport/paypalrestcall.php</b> on line <b>57</b><br /> <br /> <b>notice</b>:  use of undefined constant curlopt_ssl_verifyhost - assumed 'curlopt_ssl_verifyhost' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/transport/paypalrestcall.php</b> on line <b>57</b><br /> <br /> <b>notice</b>:  use of undefined constant curlopt_ssl_verifypeer - assumed 'curlopt_ssl_verifypeer' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/transport/paypalrestcall.php</b> on line <b>57</b><br /> <br /> <b>notice</b>:  use of undefined constant curlopt_ssl_cipher_list - assumed 'curlopt_ssl_cipher_list' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/transport/paypalrestcall.php</b> on line <b>57</b><br /> <br /> <b>fatal error</b>:  call undefined function paypal\core\curl_version() in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/paypal/core/paypalhttpconfig.php</b> on line <b>65</b><br /> 

in case, problem woocommerce paypal pro payment gateway , woocommerce product vendors because curl not installed default on digitalocean server. woocommerce product vendors, every time customer places order, vendor gets paid commission paypal mass payments. in order paypal mass payment work, have make sure enable mass payments on paypal account , make sure curl installed on server.

as installed curl, worked. here how install curl on digitalocean https://www.digitalocean.com/community/questions/curl-is-not-installed-in-your-php-installation

hope helps out there.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -