Title: Error message: syntax error, unexpected &#8216; global&#8217; (T_STRING)
Last modified: September 6, 2020

---

# Error message: syntax error, unexpected ‘ global’ (T_STRING)

 *  Resolved [shoot2](https://wordpress.org/support/users/shoot2/)
 * (@shoot2)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/error-message-syntax-error-unexpected-global-t_string/)
 * dear all,
 * After i replace orginal file got this error? What happend?
 * public_html/wp-content/plugins/booked-woocommerce-payments/lib/woocommerce/class-
   wc-cart.php. Error message: syntax error, unexpected ‘ global’ (T_STRING)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [shoot2](https://wordpress.org/support/users/shoot2/)
 * (@shoot2)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/error-message-syntax-error-unexpected-global-t_string/#post-13366661)
 * class Booked_WC_Cart_Hooks {
 *  public static function woocommerce_checkout_fields( $fields ) {
    151 >>>   global
   $woocommerce;    $booked_first_name = $woocommerce->session->get( ‘booked_first_name’);
   $booked_last_name = $woocommerce->session->get( ‘booked_last_name’ );    $booked_email
   = $woocommerce->session->get( ‘booked_email’ );
 *     if(!is_null($booked_first_name)):
        $fields[‘billing’][‘billing_first_name’][‘
   default’] = $booked_first_name;    endif;    if(!is_null($booked_last_name)):
   $fields[‘billing’][‘billing_last_name’][‘default’] = $booked_last_name;    endif;
   if(!is_null($booked_email)):     $fields[‘billing’][‘billing_email’][‘default’]
   = $booked_email;    endif;    return $fields; }
 *  [Rynald0s](https://wordpress.org/support/users/rynald0s/)
 * (@rynald0s)
 * Automattic Happiness Engineer
 * [5 years, 8 months ago](https://wordpress.org/support/topic/error-message-syntax-error-unexpected-global-t_string/#post-13374875)
 * Hi [@shoot2](https://wordpress.org/support/users/shoot2/)!
 * It is never a good idea to make changes to any core files. I am not sure about
   the plugin you are using ( `booked-woocommerce-payments` ), but your best bet
   would be to reach out to the author of that plugin and see if there is a code
   snippet available for what exactly you need to achieve, without you having to
   override the core code.
 * Cheers!
 *  Thread Starter [shoot2](https://wordpress.org/support/users/shoot2/)
 * (@shoot2)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/error-message-syntax-error-unexpected-global-t_string/#post-13375389)
 * Solved. ??? PHPissues.
 *  Plugin Support [Kel C. a11n](https://wordpress.org/support/users/kellymetal/)
 * (@kellymetal)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/error-message-syntax-error-unexpected-global-t_string/#post-13375895)
 * Hi there,
 * That `Booked_WC_Cart_Hooks` class that you are editing in the `booked-woocommerce-
   payments` plugin is not part of the core WooCommerce plugin (which is what this
   support forum is for). For assistance with that plugin, please contact the support
   team for that plugin — it appears that might be the Payments add-on for the Booked
   WooCommerce plugin here:
    [https://getbooked.io/](https://getbooked.io/)
 * Best of luck and take care! If you have any questions about the core WooCommerce
   plugin, please feel free to open a new forum post. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Error message: syntax error, unexpected ‘ global’ (T_STRING)’ 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/)

 * 4 replies
 * 3 participants
 * Last reply from: [Kel C. a11n](https://wordpress.org/support/users/kellymetal/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/error-message-syntax-error-unexpected-global-t_string/#post-13375895)
 * Status: resolved