• Resolved ctcon

    (@ctcon)


    following warning is on thankyou page of woocommerce:
    Warning: Illegal string offset ‘cart’ in woocommerce-ac.php on line 1744

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor chetnapatel

    (@chetnapatel)

    Hi,

    Thank you for sharing the error message.

    We have fixed this issue on our staging server. And we will release this fix in our next plugin update.

    Can you please provide us your email address with us? So I can send you an updated copy of our plugin file with the fix of error message issue.

    Regards,
    Chetna Bhutka

    Maxime Jobin

    (@maximejobin)

    Can the solution be shared here ?

    taagghana

    (@taagghana)

    Same problem here.
    Please share the solution here

    Plugin Contributor chetnapatel

    (@chetnapatel)

    Hi All,

    You can fix the issue as below by changing the code from line number 1743 to 1783 in the same “woocommerce-ac.php” file of our plugin. It is located at “woocommerce-abandoned-cart” core folder of our plugin.

    if ( isset( $current_woo_cart['cart'] ) && isset( $abandoned_cart_arr['cart'] ) ) {  
                    $temp_variable      = "";  
                    if ( count( $current_woo_cart['cart'] ) >= count( $abandoned_cart_arr['cart'] ) ) {
                        //do nothing
                    } else {
                        $temp_variable      = $current_woo_cart;
                        $current_woo_cart   = $abandoned_cart_arr;
                        $abandoned_cart_arr = $temp_variable;
                    }
                    if ( is_array( $current_woo_cart ) && is_array( $abandoned_cart_arr ) ) {
                        foreach ( $current_woo_cart as $key => $value ) {
                            
                            foreach ( $value as $item_key => $item_value ) {
                                $current_cart_product_id   = $item_value['product_id'];
                                $current_cart_variation_id = $item_value['variation_id'];
                                $current_cart_quantity     = $item_value['quantity'];
                
                                if ( isset( $abandoned_cart_arr[$key][$item_key]['product_id'] ) ) {
                                    $abandoned_cart_product_id = $abandoned_cart_arr[$key][$item_key]['product_id'];
                                } else {
                                    $abandoned_cart_product_id = "";
                                }
                                if ( isset( $abandoned_cart_arr[$key][$item_key]['variation_id'] ) ) {
                                     $abandoned_cart_variation_id = $abandoned_cart_arr[$key][$item_key]['variation_id']; 
                                } else {
                                    $abandoned_cart_variation_id = "";
                                }
                                if ( isset( $abandoned_cart_arr[$key][$item_key]['quantity'] ) ) {
                                     $abandoned_cart_quantity = $abandoned_cart_arr[$key][$item_key]['quantity'];
                                } else {
                                     $abandoned_cart_quantity = "";
                                }
                                if ( ( $current_cart_product_id != $abandoned_cart_product_id ) ||
                                     ( $current_cart_variation_id != $abandoned_cart_variation_id ) ||
                                     ( $current_cart_quantity != $abandoned_cart_quantity ) )
                                {
                                    return false;
                                }
                            }
                        }
                    }
                }
                return true;

    Can you please change the code and let me know if the issue fixed or not?

    Please let me know if you have any further queries.

    Regards,
    Chetna Bhutka

    inspiredmind

    (@inspiredmind)

    This exact same error message shows up very intermitently on my site too. It seems to only be when I view a particular product (which happens to be a “gift card” product type, generated with the YITH Gift Cards plug-in). So I was suspecting it had something to do with code in your plug-in not handling this custom product type correctly.

    I’ll apply the changes you have suggested, and see if it goes away. I’ll let you know.

    Plugin Contributor chetnapatel

    (@chetnapatel)

    Hi,

    The same error message should be fixed by the provided solution.

    Please feel free to revert back whether it is working fine or not.

    Regards,
    Chetna Bhutka

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Warning: Illegal string offset ‘cart’ in woocommerce-ac.php on line 1744’ is closed to new replies.