Title: Error with Woocommerce Subscriptions
Last modified: December 16, 2019

---

# Error with Woocommerce Subscriptions

 *  Resolved [mgereta](https://wordpress.org/support/users/mgereta/)
 * (@mgereta)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/error-with-woocommerce-subscriptions/)
 * The plugin is breaking for me with WooCommerce subscriptions.
    The line: if (!
   $user_id = WC()->session->get(‘aepc_user_id’) ) appears to be breaking because
   automated orders do not have a Woocommerce session setup.
 * Unexpected shutdown: PHP Fatal error Uncaught Error: Call to a member function
   get() on null in /pixel-caffeine/includes/supports/class-aepc-woocommerce-addon-
   support.php:183
    Stack trace: #0 /pixel-caffeine/includes/supports/class-aepc-
   woocommerce-addon-support.php(533): AEPC_Woocommerce_Addon_Support->get_session_user_id()#
   1 /pixel-caffeine/includes/supports/class-aepc-woocommerce-addon-support.php(
   542): AEPC_Woocommerce_Addon_Support->get_queue_transient_name(”) #2 /pixel-caffeine/
   includes/supports/class-aepc-woocommerce-addon-support.php(161): AEPC_Woocommerce_Addon_Support-
   >get_purchase_queue(”) #3 /public_html/wp-includes/class-wp-hook.php(288): AEPC_Woocommerce_Addon_Support-
   >register_purchase_event(287450) #4 /public_html/wp-includes/class-wp-hook.php(
   312): WP_Hook->apply_filters(NULL, Array) #5 /public_ in /pixel-caffeine/includes/
   supports/class-aepc-woocommerce-addon-support.php on line 183

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

 *  [Jon Brown](https://wordpress.org/support/users/jb510/)
 * (@jb510)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/error-with-woocommerce-subscriptions/#post-12244932)
 * I’m seeing the exact same error with woocommerce subscriptions.
 * \`
    2019-11-17 00:51:42 +0000 action created 2019-12-17 00:52:35 +0000 action
   started 2019-12-17 00:52:41 +0000 unexpected shutdown: PHP Fatal error Uncaught
   Error: Call to a member function get() on null in /home/s1/html/wp-content/plugins/
   pixel-caffeine/includes/supports/class-aepc-woocommerce-addon-support.php:183
   Stack trace: #0 /home/s1/html/wp-content/plugins/pixel-caffeine/includes/supports/
   class-aepc-woocommerce-addon-support.php(533): AEPC_Woocommerce_Addon_Support-
   >get_session_user_id() #1 /home/s1/html/wp-content/plugins/pixel-caffeine/includes/
   supports/class-aepc-woocommerce-addon-support.php(542): AEPC_Woocommerce_Addon_Support-
   >get_queue_transient_name(”) #2 /home/s1/html/wp-content/plugins/pixel-caffeine/
   includes/supports/class-aepc-woocommerce-addon-support.php(161): AEPC_Woocommerce_Addon_Support-
   >get_purchase_queue(”) #3 /home/s1/html/wp-includes/class-wp-hook.php(286): AEPC_Woocommerce_Addon_Support-
   >register_purchase_event(90706) #4 /home/s1/html/wp-includes/class-wp-hook.php(
   310): WP_Hook->apply_filters(NULL, Array) #5 /home/s1/html/wp-includes/plugin.
   php(465): WP_Hook->do_action(Array) #6 /home/s1/html/wp-content/plugins/woocommerc
   in /home/s1/html/wp-content/plugins/pixel-caffeine/includes/supports/class-aepc-
   woocommerce-addon-support.php on line 183 `
 * Not sure it’ll fix it, but as a bandaid fix I am going to try commenting out 
   the last two add_actions in the setup function in class-aepc-woocommerce-addon-
   support.php:73-89
 *     ```
       	/**
       	 * Method where set all necessary hooks launched from 'init' action
       	 */
       	public function setup() {
       		// Hooks when pixel is enabled.
       		if ( version_compare( WC()->version, '3.3', '<' ) ) {
       			add_filter( 'woocommerce_params', array( $this, 'add_currency_param' ) );
       		} else {
       			add_filter( 'woocommerce_get_script_data', array( $this, 'add_currency_param' ), 10, 2 );
       		}
       		add_action( 'woocommerce_after_shop_loop_item', array( $this, 'add_content_category_meta' ), 99 );
       		add_action( 'woocommerce_registration_redirect', array( $this, 'save_registration_data' ), 5 );
       		add_action( 'wp_footer', array( $this, 'register_add_to_cart_params' ), 10 );
       		add_action( 'wp_footer', array( $this, 'register_add_payment_info_params' ), 10 );
       		// add_action( 'woocommerce_checkout_order_processed', array( $this, 'register_user_id' ), 10, 3 );
       		// add_action( 'woocommerce_payment_complete', array( $this, 'register_purchase_event' ) );
       	}
       ```
   
    -  This reply was modified 6 years, 5 months ago by [Jon Brown](https://wordpress.org/support/users/jb510/).
 *  Thread Starter [mgereta](https://wordpress.org/support/users/mgereta/)
 * (@mgereta)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/error-with-woocommerce-subscriptions/#post-12256179)
 * Re: Jon Brown
 * On Monday I created a non-intrusive fix for this:
 *     ```
       add_action('wp_loaded', 'mg_init_wc_admin');
   
       function mg_init_wc_admin(){
           if(defined( 'DOING_CRON' )) {
               WC()->session = new WC_Session_Handler();
               WC()->session->init();
           }
       }
       ```
   
 * Because this was happening within the cronjob for subscriptions, I just simply
   create the session when WP is loaded. I havent had an error since.
 *  [myjosephines](https://wordpress.org/support/users/myjosephines/)
 * (@myjosephines)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/error-with-woocommerce-subscriptions/#post-12271374)
 * Me 2, I will just deactivate this plugin for now
 *  Plugin Author [Antonino Scarfì](https://wordpress.org/support/users/antoscarface/)
 * (@antoscarface)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/error-with-woocommerce-subscriptions/#post-12645498)
 * Hi all,
 * sorry for the missing response on this. I’m working on a new release with the
   fix to this issue. I hope to release it early next week 🙂
 *  Plugin Author [Antonino Scarfì](https://wordpress.org/support/users/antoscarface/)
 * (@antoscarface)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/error-with-woocommerce-subscriptions/#post-12677956)
 * Hi all,
 * as promised, I’ve just released the new version which fixes the issue of this
   topic. Please, upgrade the plugin to 2.1.2 in order to fix this issue 🙂
 * Have a nice day!

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

The topic ‘Error with Woocommerce Subscriptions’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/pixel-caffeine_e2ce0c.svg)
 * [Pixel Caffeine](https://wordpress.org/plugins/pixel-caffeine/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pixel-caffeine/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pixel-caffeine/)
 * [Active Topics](https://wordpress.org/support/plugin/pixel-caffeine/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pixel-caffeine/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pixel-caffeine/reviews/)

 * 5 replies
 * 4 participants
 * Last reply from: [Antonino Scarfì](https://wordpress.org/support/users/antoscarface/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/error-with-woocommerce-subscriptions/#post-12677956)
 * Status: resolved