• Resolved lalutotale

    (@lalutotale)


    Hi,

    Please excuse my rusted english but i’ll try to be as understandable as possible ??
    I launched two news composite products on my shop yesterday.
    There were no problems when I tested it.
    Since this morning (I believe there has been an update of the extension), NO ONE is ordering because when clicking on the “add to cart” button, here is the error page I get :
    “`Warning: in_array() expects parameter 2 to be array, null given in /home/lalutotakc/www/wp-content/plugins/wpc-composite-products/wpc-composite-products.php on line 1775

    Warning: in_array() expects parameter 2 to be array, null given in /home/lalutotakc/www/wp-content/plugins/wpc-composite-products/wpc-composite-products.php on line 1775

    Warning: in_array() expects parameter 2 to be array, null given in /home/lalutotakc/www/wp-content/plugins/wpc-composite-products/wpc-composite-products.php on line 1775

    Warning: in_array() expects parameter 2 to be array, null given in /home/lalutotakc/www/wp-content/plugins/wpc-composite-products/wpc-composite-products.php on line 1775

    Warning: in_array() expects parameter 2 to be array, null given in /home/lalutotakc/www/wp-content/plugins/wpc-composite-products/wpc-composite-products.php on line 1775

    Warning: in_array() expects parameter 2 to be array, null given in /home/lalutotakc/www/wp-content/plugins/wpc-composite-products/wpc-composite-products.php on line 1775

    Warning: in_array() expects parameter 2 to be array, null given in /home/lalutotakc/www/wp-content/plugins/wpc-composite-products/wpc-composite-products.php on line 1775

    Warning: in_array() expects parameter 2 to be array, null given in /home/lalutotakc/www/wp-content/plugins/wpc-composite-products/wpc-composite-products.php on line 1775

    Warning: in_array() expects parameter 2 to be array, null given in /home/lalutotakc/www/wp-content/plugins/wpc-composite-products/wpc-composite-products.php on line 1775

    Warning: Cannot modify header information – headers already sent by (output started at /home/lalutotakc/www/wp-content/plugins/wpc-composite-products/wpc-composite-products.php:1775) in /home/lalutotakc/www/wp-includes/pluggable.php on line 1340

    Warning: Cannot modify header information – headers already sent by (output started at /home/lalutotakc/www/wp-content/plugins/wpc-composite-products/wpc-composite-products.php:1775) in /home/lalutotakc/www/wp-includes/pluggable.php on line 1343”

    I just noticed that the problem ALSO appears on older composite products where I had no problem before.

    So I haven’t had any composite product sales since yesterday.
    And I missed my launch !!

    Please HELP <3

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter lalutotale

    (@lalutotale)

    If someone needs help for the same problem , my collegue found a way to debug :
    Just comment this part on line 1775 :

    <?php
    function wooco_get_cart_contents( $cart_contents ) {
        $new_keys = [];
    
        foreach ( $cart_contents as $cart_k => $cart_i ) {
            if ( ! empty( $cart_i['wooco_key'] ) ) {
                $new_keys[ $cart_k ] = $cart_i['wooco_key'];
            }
        }
    
        foreach ( $cart_contents as $cart_item_key => $cart_item ) {
            if ( ! empty( $cart_item['wooco_parent_key'] ) ) {
                $parent_key     = $cart_item['wooco_parent_key'];
                $parent_new_key = array_search( $parent_key, $new_keys );
    
                // remove orphaned components
                if ( ! $parent_new_key || ! isset( $cart_contents[ $parent_new_key ] ) ) {
                    unset( $cart_contents[ $cart_item_key ] );
                    continue;
                }
    
                if ( ( $parent_new_key === $parent_key ) && isset( $cart_contents[ $parent_key ]['wooco_key'] ) && ! in_array( $cart_item_key, $cart_contents[ $parent_key ]['wooco_keys'] ) ) {
                    unset( $cart_contents[ $cart_item_key ] );
                    continue;
                }
    
                // sync quantity
                if ( ! empty( $cart_item['wooco_qty'] ) && isset( $cart_contents[ $parent_new_key ] ) ) {
                    WC()->cart->cart_contents[ $cart_item_key ]['quantity'] = $cart_item['wooco_qty'] * $cart_contents[ $parent_new_key ]['quantity'];
                }
            }
        }
    }
    
    commented this part ( line 1175 ):
    
    /*
    if ( ( $parent_new_key === $parent_key ) && isset( $cart_contents[ $parent_key ]['wooco_key'] ) && ! in_array( $cart_item_key, $cart_contents[ $parent_key ]['wooco_keys'] ) ) {
        unset( $cart_contents[ $cart_item_key ] );
        continue;
    }
    
    */
Viewing 1 replies (of 1 total)
  • The topic ‘ERROR when adding to cart (since last update?)’ is closed to new replies.