• Resolved contemplate

    (@contemplate)


    We are seeing that some WooCommerce Subscription renewals are hitting a fatal error with Cartflows when using the Google Tracking data feature. Here is the error:

    [23-Feb-2021 15:20:10 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_cart_contents_total() on null in /public_html/wp-content/plugins/cartflows/classes/class-cartflows-tracking.php:135
    Stack trace:
    #0 /public_html/wp-content/plugins/cartflows/classes/class-cartflows-tracking.php(113): Cartflows_Tracking::get_ga_purchase_transactions_data(753929, Array)
    #1 /public_html/wp-content/plugins/cartflows/classes/class-cartflows-frontend.php(105): Cartflows_Tracking::send_ga_data_if_enabled(753929)
    #2 /public_html/wp-includes/class-wp-hook.php(287): Cartflows_Frontend->redirect_to_thankyou_page(‘https://thebala…’, Object(Automattic\WooCommerce\Admin\Overrides\Order))
    #3 /public_html/wp-includes/plugin.php(212): WP_Hook->apply_filters(‘https://thebala…’, Array)
    #4 /public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php(1585): apply_filters(‘woocommerce_get…’, ‘https://thebala…’, Object(Automattic\WooCommerce\Admin\Overrides\Order in /public_html/wp-content/plugins/cartflows/classes/class-cartflows-tracking.php on line 135

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter contemplate

    (@contemplate)

    Would adding a check like this if the order is a renewal resolve the issue?

    /wp-content/plugins/cartflows/classes/class-cartflows-tracking.php
    line 135

    
    $order             = wc_get_order( $order_id );
    if ( function_exists( 'wcs_order_contains_renewal' ) ) {
    	if ( wcs_order_contains_renewal( $order_id ) == true ) { 
    		return;
    	}
    }
    $cart_total        = WC()->cart->get_cart_contents_total();
    
    Plugin Support CartFlows Team

    (@cartflows)

    Hello @contemplate

    Thank you for getting in touch with us!

    Actually, the code which you have mentioned will work then the order is placed from the Checkout page and the user has completed the order on the thank you page.

    But will not work while making the automatic subscription renewal payment. So, in order to get more clarification, can you please open a support ticket from our website so that one of the developers will take a look at it.

    I hope this helps you.

    I am looking forward to hearing from you.

    Thread Starter contemplate

    (@contemplate)

    Yes I created ticket 1763 before I created this patch if you want to add this to the ticket.

    Yes I that is correct the code I added (above) should skip the rest of the function if it is a renewal payment since there isn’t a “cart” instance and so the get_cart_contents_total function won’t be run which is the reason for the error.

    Plugin Support CartFlows Team

    (@cartflows)

    Hello @contemplate

    Thank you for more information and clarification on the issue.

    We have started to fix this issue and we will be releasing it in the upcoming update.

    Your patience & co-operation is much appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fatal Error on subscription renewal’ is closed to new replies.