• Resolved mgereta

    (@mgereta)


    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)
  • 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 5 years, 3 months ago by Jon Brown.
    Thread Starter mgereta

    (@mgereta)

    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.

    Me 2, I will just deactivate this plugin for now

    Plugin Author Antonino Scarfì

    (@antoscarface)

    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ì

    (@antoscarface)

    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.